Skip to content

Commit eb66766

Browse files
authored
Merge pull request #1 from EiffelWebFramework/pg_dev
Pg dev
2 parents 1f58868 + df8d5eb commit eb66766

24 files changed

+1763
-6
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ EIFGENs
22
*.swp
33
*.rc
44

5+
system.log
6+
token.access
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
note
2+
description: "Summary description for {OAUTH_20_GOOGLE_API}."
3+
date: "$Date: 2020-08-04 12:05:41 -0300 (Tue, 04 Aug 2020) $"
4+
revision: "$Revision: 104570 $"
5+
EIS: "name=OAuth2 google apis", "src=https://developers.google.com/accounts/docs/OAuth2", "protocol=uri"
6+
7+
class
8+
OAUTH_20_GOOGLE_API
9+
10+
inherit
11+
12+
OAUTH_20_API
13+
redefine
14+
access_token_extractor,
15+
access_token_verb
16+
end
17+
18+
feature -- Access
19+
20+
access_token_extractor: ACCESS_TOKEN_EXTRACTOR
21+
do
22+
create {JSON_TOKEN_EXTRACTOR} Result
23+
end
24+
25+
access_token_verb: STRING_8
26+
-- <Precursor>
27+
do
28+
Result := "POST"
29+
end
30+
31+
access_token_endpoint: STRING_8
32+
-- Url that receives the access token request
33+
do
34+
create {STRING_8} Result.make_from_string ("https://oauth2.googleapis.com/token")
35+
end
36+
37+
authorization_url (config: OAUTH_CONFIG): detachable STRING_8
38+
-- Url where you should redirect your users to authneticate
39+
do
40+
if attached config.scope as l_scope then
41+
create Result.make_from_string (TEMPLATE_AUTHORIZE_URL + SCOPED_AUTHORIZE_URL)
42+
Result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
43+
if attached config.callback as l_callback then
44+
Result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_8))
45+
end
46+
Result.replace_substring_all ("$SCOPE", (create {OAUTH_ENCODER}).encoded_string (l_scope.as_string_8))
47+
else
48+
create Result.make_from_string (TEMPLATE_AUTHORIZE_URL)
49+
Result.replace_substring_all ("$CLIENT_ID", config.api_key.as_string_8)
50+
if attached config.callback as l_callback then
51+
Result.replace_substring_all ("$REDIRECT_URI", (create {OAUTH_ENCODER}).encoded_string (l_callback.as_string_8))
52+
end
53+
end
54+
end
55+
56+
feature -- Implementation
57+
58+
Template_authorize_url: STRING_8 = "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URI"
59+
60+
Scoped_authorize_url: STRING = "&scope=$SCOPE"
61+
62+
note
63+
copyright: "2013-2020, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
64+
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
65+
source: "[
66+
Eiffel Software
67+
5949 Hollister Ave., Goleta, CA 93117 USA
68+
Telephone 805-685-1006, Fax 805-685-6869
69+
Website http://www.eiffel.com
70+
Customer support http://support.eiffel.com
71+
]"
72+
end

sheets/Readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Eiffel API for Google Sheets API
2+
3+
https://developers.google.com/sheets/api/reference/rest
4+
5+
6+
OAuth2.0 Client credentials
7+
To begin, obtain OAuth 2.0 client credentials from the [Browser Quickstart](https://developers.google.com/sheets/api/quickstart/js) and enable the credentials.
8+
9+
10+
- EG_SHEETS_I -- it's an interface where we work with Eiffel Objects
11+
- EG_SHEETS_API -- It's the low level interface that sends and receives HTTP messages..
12+
- EG_SHEETS_JSON -- it's the implementation where we map from the HTTP messages encoded in JSON format to the Eiffel side. (and vice versa).
13+
14+
Then in the object cluster we have the Eiffel objects representing the API domain.

sheets/esheets.ecf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
2121
<library name="cypress_consumer" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\consumer\consumer.ecf" readonly="false"/>
2222
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
23+
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
2324
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
25+
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging.ecf"/>
2426
<library name="login_with_google" location="$ISE_LIBRARY\contrib\library\web\authentication\oauth\cypress\login_with\google\login_with_google.ecf" readonly="false"/>
2527
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/>
2628
<cluster name="esheets_api" location=".\src\" recursive="true"/>

0 commit comments

Comments
 (0)