Skip to content

Commit 47ac9a4

Browse files
committed
CHANGE: made the source compatible with Rebol 3.16.0 and newer
1 parent 195a961 commit 47ac9a4

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v3
1818

1919
- name: Install Rebol for the test
20-
uses: oldes/install-rebol@v3.11.0
20+
uses: oldes/install-rebol@v3.16.0
2121
with:
2222
product: Bulk
2323

google-test.r3

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Rebol [
33
Date: 11-Jul-2023
44
Author: @Oldes
55
File: %google-test.r3
6+
Needs: 3.16.0
67
]
78

89
system/options/quiet: false ;; allow traces
@@ -33,16 +34,16 @@ do-test "User's profile" [
3334
]
3435

3536
do-test "Create a new contact" [
36-
probe person: people/create #(
37-
names: [#(
37+
probe person: people/create #[
38+
names: [#[
3839
familyName: "Example"
3940
givenName: "Test"
40-
)]
41+
]]
4142
emailAddresses: [
42-
#(value: "test@example.com")
43-
#(value: "another-test@example.com")
43+
#[value: "test@example.com"]
44+
#[value: "another-test@example.com"]
4445
]
45-
)
46+
]
4647
]
4748

4849
if person [

google.reb

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Rebol [
22
Title: "Google"
33
Purpose: "Google Web API access (experimental)"
4-
Date: 14-Jul-2023
4+
Date: 13-May-2024
55
Author: @Oldes
66
File: %google.reb
77
Name: 'google
88
Type: 'module
9-
Version: 0.0.5
9+
Version: 0.0.6
1010
Require: 'httpd
1111
Note: {
1212
Useful info:
@@ -39,7 +39,7 @@ config: function[
3939
ctx/client-secret: ask/hide "Client Secret: "
4040
][ ;; when user hits ESC...
4141
sys/log/error 'GOOGLE "Missing credentials!"
42-
return #()
42+
return make map! []
4343
]
4444
;; All scopes?
4545
ctx/scopes: [
@@ -239,14 +239,12 @@ refresh: function[
239239
store-config ctx
240240
]
241241

242-
request: func [
242+
request: function/with [
243243
method [word!]
244244
what [any-string!]
245245
data [any-type!]
246-
/local ctx header result
247246
][
248-
header: clear #()
249-
247+
clear header
250248
try/with [
251249
ctx: config
252250
unless ctx/token [ctx: authorize ctx] ;; resolve the token
@@ -276,6 +274,8 @@ request: func [
276274
sys/log/error 'GOOGLE system/state/last-error
277275
none
278276
]
277+
][
278+
header: make map! 6
279279
]
280280

281281
api-get: func [what [any-string!] ][request 'GET what none]
@@ -406,26 +406,26 @@ gmail: function [request [ref! block!]][
406406
;; https://www.googleapis.com/auth/gmail.metadata
407407

408408
;; Returns something like:
409-
;; #(
409+
;; #[
410410
;; emailAddress: "some@email"
411411
;; messagesTotal: 1234
412412
;; threadsTotal: 23
413413
;; historyId: "16337600"
414-
;; )
414+
;; ]
415415
)
416416
|
417417
'messages (
418418
keep api-get https://gmail.googleapis.com/gmail/v1/users/me/messages
419419

420420
;; Returns something like:
421-
;; #(
422-
;; messages: [#(
421+
;; #[
422+
;; messages: [#[
423423
;; id: "18949a4bbc4cce97"
424424
;; threadId: "189446292fce7946"
425425
;; )]
426426
;; nextPageToken: "05405932033369967487"
427427
;; resultSizeEstimate: 201
428-
;; )
428+
;; ]
429429
)
430430
| 'message set id: string! (
431431
keep api-get join https://gmail.googleapis.com/gmail/v1/users/me/messages/ id
@@ -469,7 +469,7 @@ photos: context [
469469
length [integer!]
470470
][
471471
url: https://photoslibrary.googleapis.com/v1/mediaItems:search
472-
req: #() ;; no copy, because it is reused for all requests
472+
req: make map! 4 ;; no copy, because it is reused for all requests
473473
req/albumId: album
474474
req/pageSize: either part [min 100 length][100]
475475
nextPageToken: none

0 commit comments

Comments
 (0)