Skip to content

Commit e4e750a

Browse files
committed
Added Cypress Branch 18_11.
1 parent 2b2fa27 commit e4e750a

File tree

214 files changed

+6377
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+6377
-457
lines changed

.travis.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: eiffel
2+
before_script:
3+
- export current_dir=$PWD ; echo current_dir=$current_dir ; cd ..
4+
- export ISE_PLATFORM=linux-x86-64
5+
- curl -sSL https://www.eiffel.org/setup/install.sh | bash > eiffel.rc
6+
- source ./eiffel.rc
7+
- echo `ec -version`
8+
- cd $current_dir
9+
10+
# safelist
11+
branches:
12+
only:
13+
- cypress_18_11
14+
- develop
15+
16+
script:
17+
#compile code
18+
- compile_all -ecb -melt -list_failures -log_verbose -clean -options dotnet=false
19+
#testing
20+
- ec -config test/test_suite.ecf -c_compile -tests

apis/facebook/api/facebook_api.ecf

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<capability>
1616
<concurrency support="none"/>
1717
</capability>
18-
<library name="login_with" location="..\..\..\login_with\login_with.ecf" readonly="false"/>
1918
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
2019
<library name="cypress_consumer" location="..\..\..\consumer\consumer-safe.ecf" readonly="false"/>
2120
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
2221
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
22+
<library name="login_with_facebook" location="..\..\..\login_with\facebook\login_with_facebook.ecf" readonly="false"/>
2323
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri-safe.ecf"/>
2424
<cluster name="facebook_api" location=".\src\" recursive="true"/>
2525
</target>

apis/facebook/api/src/facebook_api.e

+88-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
note
2-
description: "Summary description for {FACEBOOK_API}."
3-
date: "$Date$"
4-
revision: "$Revision$"
2+
description: "[
3+
Facebook API Interface: specify how to read and write Facebook data.
4+
]"
5+
date: "$Date: 2018-09-06 13:07:18 -0300 (ju. 06 de sep. de 2018) $"
6+
revision: "$Revision: 102137 $"
7+
EIS: "name=Facebook Graph API", "src=http://developers.facebook.com/docs/api", "protocol=uri"
58

69
class
710
FACEBOOK_API
@@ -124,9 +127,53 @@ feature -- Facebook: Get User
124127
end
125128
end
126129

130+
user_likes (a_path: STRING; a_params: detachable FB_PAGE_PARAMETER): detachable STRING
131+
do
132+
if
133+
a_params /= Void and then
134+
attached a_params.parameters as l_parameters
135+
then
136+
api_get_call (facebook_url (a_path, l_parameters ), Void)
137+
else
138+
if a_path.starts_with ("https") then
139+
api_get_call (a_path, Void)
140+
else
141+
api_get_call (facebook_url (a_path, Void ), Void)
142+
end
143+
end
144+
if
145+
attached last_response as l_response and then
146+
attached l_response.body as l_body
147+
then
148+
Result := l_body
149+
end
150+
end
151+
152+
user_groups (a_path: STRING; a_params: detachable FB_GROUP_PARAMETER): detachable STRING
153+
do
154+
if
155+
attached a_params and then
156+
attached a_params.parameters as l_parameters
157+
then
158+
api_get_call (facebook_url (a_path, l_parameters ), Void)
159+
else
160+
if a_path.starts_with ("https") then
161+
api_get_call (a_path, Void)
162+
else
163+
api_get_call (facebook_url (a_path, Void ), Void)
164+
end
165+
end
166+
if
167+
attached last_response as l_response and then
168+
attached l_response.body as l_body
169+
then
170+
Result := l_body
171+
end
172+
end
173+
127174
feature -- Feeds: publish, delete, update
128175

129-
user_feed_publish (a_user_id: STRING; a_params: detachable FB_USER_FEED_PUBLISHING): detachable STRING
176+
publish_on_user_feed (a_user_id: STRING; a_params: detachable FB_USER_FEED_PUBLISHING): detachable STRING
130177
do
131178
api_post_call (facebook_url (a_user_id, Void ), a_params, Void)
132179
if
@@ -148,11 +195,23 @@ feature -- Feeds: publish, delete, update
148195
end
149196
end
150197

151-
user_feed_publish_photo (a_user_id: STRING; a_photo: PATH): detachable STRING
152-
local
153-
l_file: RAW_FILE
198+
publish_photo_on_user_feed (a_user_id: STRING; a_photo: PATH; a_params: detachable FB_USER_FEED_PUBLISHING ): detachable STRING
154199
do
155-
api_post_call (facebook_url (a_user_id, Void ), Void, [a_photo, "multipart/form-data; boundary=%"attachment boundary%""])
200+
api_post_call (facebook_url (a_user_id, Void ), a_params, [a_photo, "multipart/form-data"])
201+
202+
if
203+
attached last_response as l_response and then
204+
attached l_response.body as l_body
205+
then
206+
Result := l_body
207+
end
208+
end
209+
210+
211+
publish_video_on_user_feed (a_user_id: STRING; a_video: PATH; a_params: detachable FB_VIDEO_PUBLISHING ): detachable STRING
212+
do
213+
api_post_call (facebook_video_url (a_user_id, Void ), a_params, [a_video, "multipart/form-data"])
214+
156215
if
157216
attached last_response as l_response and then
158217
attached l_response.body as l_body
@@ -262,7 +321,7 @@ feature {NONE} -- Implementation
262321
EIS:"name=access token", "src=https://developers.facebook.com/docs/facebook-login/access-tokens", "protocol=uri"
263322
local
264323
request: OAUTH_REQUEST
265-
l_access_token, request_token: detachable OAUTH_TOKEN
324+
l_access_token: detachable OAUTH_TOKEN
266325
api_service: OAUTH_20_SERVICE
267326
do
268327
-- Initialization
@@ -295,7 +354,7 @@ feature {NONE} -- Implementation
295354
end
296355

297356
facebook_url (a_query: STRING; a_params: detachable STRING): STRING
298-
-- Twitter url for `a_query' and `a_parameters'
357+
-- Facebook url for `a_query' and `a_parameters'
299358
require
300359
a_query_attached: a_query /= Void
301360
do
@@ -308,6 +367,20 @@ feature {NONE} -- Implementation
308367
Result_attached: Result /= Void
309368
end
310369

370+
facebook_video_url (a_query: STRING; a_params: detachable STRING): STRING
371+
-- Facebook url for `a_query' and `a_parameters'
372+
require
373+
a_query_attached: a_query /= Void
374+
do
375+
Result := "https://graph-video.facebook.com/v2.9/" + a_query
376+
if attached a_params then
377+
Result.append_character ('?')
378+
Result.append (a_params)
379+
end
380+
ensure
381+
Result_attached: Result /= Void
382+
end
383+
311384
url (a_base_url: STRING; a_parameters: detachable ARRAY [detachable TUPLE [name: STRING; value: STRING]]): STRING
312385
-- url for `a_base_url' and `a_parameters'
313386
require
@@ -355,16 +428,13 @@ feature {NONE} -- Implementation
355428
end
356429

357430
add_parameters (a_method: STRING; request:OAUTH_REQUEST; a_params: detachable STRING_TABLE [STRING])
431+
-- add parameters 'a_params' (with key, value) to the oauth request 'request'.
432+
--| at the moment all params are added to the query_string.
358433
do
359-
if a_method.is_case_insensitive_equal_general ("GET") or else a_method.is_case_insensitive_equal_general ("DELETE") then
360-
add_query_string (request, a_params)
361-
else
362-
check is_post: a_method.is_case_insensitive_equal_general ("POST") end
363-
add_body_parameters (request, a_params)
364-
end
434+
add_query_parameters (request, a_params)
365435
end
366436

367-
add_query_string (request:OAUTH_REQUEST; a_params: detachable STRING_TABLE [STRING])
437+
add_query_parameters (request:OAUTH_REQUEST; a_params: detachable STRING_TABLE [STRING])
368438
do
369439
if attached a_params then
370440
across a_params as ic
@@ -393,9 +463,8 @@ feature {NONE} -- Implementation
393463
create l_raw_file.make_open_read (l_upload_data.file_name.absolute_path.name)
394464
if l_raw_file.exists then
395465
request.add_header ("Content-Type", l_upload_data.content_type)
396-
request.add_header ("Content-Disposition", "form-data; filename=%"+ l_upload_data.file_name.name%"")
397-
request.add_header ("Content-Length", l_raw_file.count.out)
398466
request.set_upload_filename (l_upload_data.file_name.absolute_path.name)
467+
request.add_form_parameter("source", l_upload_data.file_name.name.as_string_32)
399468
end
400469
end
401470
end

apis/facebook/api/src/facebook_i.e

+26-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ feature --Get - User
6060
deferred
6161
end
6262

63+
user_likes (a_user_id: STRING; a_params: detachable FB_PAGE_PARAMETER): detachable FB_EDGES [FB_PAGE]
64+
-- All the Pages this person has liked
65+
-- GET /{user_id}/likes
66+
note
67+
EIS: "name=User likes", "src=https://developers.facebook.com/docs/graph-api/reference/user/likes/", "protocol=uri"
68+
deferred
69+
end
70+
71+
user_groups (a_user_id: STRING; a_params: detachable FB_GROUP_PARAMETER): detachable FB_EDGES [FB_GROUP]
72+
-- The Facebook Groups that the person is an admin of
73+
-- GET /{user_id}/groups
74+
note
75+
EIS: "name=User Groups", "src=https://developers.facebook.com/docs/graph-api/reference/user/groups/", "protocol=uri"
76+
deferred
77+
end
78+
6379
feature -- Post
6480

6581
post (a_post_id: READABLE_STRING_32; a_params: detachable FB_POST_PARAMETER): detachable FB_POST
@@ -82,7 +98,7 @@ feature -- Feed: Publish, Delete
8298
deferred
8399
end
84100

85-
publish_photo_on_user_feed (a_user_id: STRING; a_photo: PATH): detachable STRING
101+
publish_photo_on_user_feed (a_user_id: STRING; a_photo: PATH; a_params: detachable FB_USER_FEED_PUBLISHING): detachable STRING
86102
-- Uploading a photo to the user `a_user_id' timeline.
87103
-- Attach the photo `a_potho' as multipart/form-data.
88104
-- POST /{a_user_id}/photo
@@ -91,6 +107,15 @@ feature -- Feed: Publish, Delete
91107
deferred
92108
end
93109

110+
publish_video_on_user_feed (a_user_id: STRING; a_video: PATH; a_params: detachable FB_VIDEO_PUBLISHING): detachable STRING
111+
-- Uploading a video to the user `a_user_id' timeline.
112+
-- Attach the video `a_video' as multipart/form-data.
113+
-- POST /{a_user_id}/videos
114+
note
115+
EIS: "name=Publish Video", "src=https://developers.facebook.com/docs/graph-api/reference/user/videos/#Creating", "protocol=uri"
116+
deferred
117+
end
118+
94119
delete_feed (a_post_id: STRING): BOOLEAN
95120
deferred
96121
end

0 commit comments

Comments
 (0)