Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Includes Javiers changes #13

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added calendar/Readme.md
Empty file.
30 changes: 30 additions & 0 deletions calendar/escalendar.ecf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-20-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-20-0 http://www.eiffel.com/developers/xml/configuration-1-20-0.xsd" name="escalenadar_api" uuid="7CAA645C-314C-45A2-B718-40F4B76AB41F" library_target="escalenadar_api">
<target name="escalenadar_api">
<root all_classes="true"/>
<file_rule>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/\.git$</exclude>
<exclude>/\.svn$</exclude>
</file_rule>
<option manifest_array_type="mismatch_warning">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<setting name="total_order_on_reals" value="false"/>
<capability>
<concurrency support="scoop"/>
<void_safety support="transitional"/>
</capability>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="eg_base" location="..\gsuite_base\eg_base.ecf" readonly="false"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="json_ext" location="\home\anders\github_eiffel_liraries\json_ext_original\json_ext\json_ext.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/>
<cluster name="escalenadar_api" location=".\src\" recursive="true"/>
</target>
</system>
35 changes: 35 additions & 0 deletions calendar/src/calendar_date.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
note
description: "Summary description for {CALENDAR_DATE}."
author: ""
date: "$Date$"
revision: "$Revision$"

class
CALENDAR_DATE

create
make

feature

make(d:DATE; dt: DATE_TIME; tz: STRING)
local
tools :DATE_TIME_TOOLS
do
a_date := d





a_date_time := dt
a_time_zone := tz

end

a_date:DATE
a_date_time : DATE_TIME
a_time_zone : STRING


end
102 changes: 102 additions & 0 deletions calendar/src/calendar_date_payload.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
note
description: "Summary description for {CALENDAR_START_PAYLOAD}."
author: ""
date: "$Date$"
revision: "$Revision$"

class
CALENDAR_DATE_PAYLOAD

inherit
JSON_SERIALIZABLE
undefine
default_create
redefine
json_out,
eiffel_date_to_json_string,
eiffel_date_time_to_json_string
end

create
make_with_date,
default_create


feature

make_with_date(d: CALENDAR_DATE)
do
date := d.a_date
datetime := d.a_date_time
timezone := d.a_time_zone
end


default_create
do
create date.make_now
create datetime.make_now
create timezone.make_empty
end

date: DATE
-- What is the `date' of the Event?
attribute
create Result.make_now
end

datetime: DATE_TIME
-- What is the `datetime' of the Event?
attribute
create Result.make_now
end

timeZone: STRING
-- What `timezone' is the Event in?
attribute
create Result.make_empty
end
feature -- Implementation

eiffel_date_to_json_string (a_key: STRING; a_date: DATE): JSON_STRING
-- Convert `a_date' to JSON_STRING with `a_key'
do
create Result.make_from_string_32 (a_date.formatted_out ("YYYY-[0]MM-[0]DD"))
end


eiffel_date_time_to_json_string (a_key: STRING; a_date_time: DATE_TIME): JSON_STRING
-- Convert `a_date_time' to JSON_STRING with `a_key'
do
create Result.make_from_string_32 (a_date_time.formatted_out ("YYYY-[0]MM-[0]DD") + "T" + a_date_time.formatted_out ("[0]hh:[0]mi")+ ":00")
end



json_out: STRING
--<Precursor>
-- Convert `end_event' to "end", `datetime' to "dateTime", `timezone' to "timeZone" per Google.
do
Result := Precursor
Result.replace_substring_all ("ending", "end")
Result.replace_substring_all ("datetime", "dateTime")
Result.replace_substring_all ("timezone", "timeZone")
end

metadata_refreshed (a_current: ANY): ARRAY [JSON_METADATA]
do
Result := <<
create {JSON_METADATA}.make_text_default
>>
end

convertible_features (a_object: ANY): ARRAY [STRING]
-- <Precursor>
once
Result := <<"datetime","timezone">>
-- Result := <<"date","dateTime","timeZone">>
end



end
42 changes: 42 additions & 0 deletions calendar/src/calendar_event.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
note
description: "Summary description for {CALENDAR_EVENT}."
author: ""
date: "$Date$"
revision: "$Revision$"

class
CALENDAR_EVENT

create
make_generate_id,
make

feature


make(start_date, end_date : CALENDAR_DATE; sum, event_id : STRING)
do
sd := start_date
ed := end_date
id := event_id
summary := sum
end


make_generate_id(start_date, end_date : CALENDAR_DATE)
do
sd := start_date
ed := end_date
id := "create unique id"
summary := "summary"
end

sd:CALENDAR_DATE
ed:CALENDAR_DATE
id : STRING
summary : STRING




end
92 changes: 92 additions & 0 deletions calendar/src/calendar_event_payload.e
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
note
description: "Summary description for {CALENDAR_EVENT_PAYLOD}."
author: ""
date: "$Date$"
revision: "$Revision$"

class
CALENDAR_EVENT_PAYLOAD

inherit
JSON_SERIALIZABLE
undefine
default_create
redefine
json_out
end

create
make,
default_create


feature

make (ce: CALENDAR_EVENT )
do
kind:= "calendar#event"
summary := ce.summary
create start.make_with_date (ce.sd)
create ending.make_with_date (ce.ed)
id := ce.id
end

default_create
do
id := ""
kind:= ""
summary:=""
create start
create ending
end

id : STRING
kind: STRING
summary: STRING
start: CALENDAR_DATE_PAYLOAD
ending: CALENDAR_DATE_PAYLOAD



feature {NONE} -- Implementation: Representation Constants

-- current_representation: STRING
-- do
-- Result := "{" +
-- "%"start%":%"" + start + "%"," +
-- "%"end%":%"" + ending + "%"" +
-- "}"

-- end

feature -- Implementation: Mock Features




feature -- Implementation
json_out: STRING
--<Precursor>
-- Convert `end_event' to "end", `datetime' to "dateTime", `timezone' to "timeZone" per Google.
do
Result := Precursor
Result.replace_substring_all ("ending", "end")
Result.replace_substring_all ("datetime", "dateTime")
Result.replace_substring_all ("timezone", "timeZone")
end


metadata_refreshed (a_current: ANY): ARRAY [JSON_METADATA]
do
Result := <<
create {JSON_METADATA}.make_text_default
>>
end

convertible_features (a_object: ANY): ARRAY [STRING]
-- <Precursor>
once
Result := <<"summary","kind","start", "ending","id">>
end

end
Loading