cronofy 0.30.0 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/cronofy.gemspec +1 -1
- data/lib/cronofy/client.rb +28 -1
- data/lib/cronofy/types.rb +3 -0
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/client_spec.rb +64 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 33f1ecf7569c8c425473149e5f926e64e9f1a09c194f2c77dfa092048e0a347a
|
4
|
+
data.tar.gz: ca5415981d65cc82c9b53ea9886f8e1acdd299390f2db18a6f78b8203f680968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 846e3d33bb4a9c7b72e51881df03d42176e51e190563603d589d036c8f1d29d5f36ff54f2a6abe906264f03928e9efca06035694f3a8207cbe790527323b2e41
|
7
|
+
data.tar.gz: 064dbc5c4b14edb8917eeccefebf93ab82e94e6e2be751d82949f1ecd0c6a65f8f255a29c4910e9d219c21d30e774e816c784776d21349f48fc8ae73db9afc4a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [0.31.0]
|
2
|
+
|
3
|
+
* Added support for Element Tokens [#69]
|
4
|
+
|
1
5
|
## [0.30.0]
|
2
6
|
|
3
7
|
* Added support for sequencing, buffers and intervals [#62]
|
@@ -127,6 +131,7 @@
|
|
127
131
|
[0.28.1]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.28.1
|
128
132
|
[0.29.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.29.0
|
129
133
|
[0.30.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.30.0
|
134
|
+
[0.31.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.31.0
|
130
135
|
|
131
136
|
[#13]: https://github.com/cronofy/cronofy-ruby/pull/13
|
132
137
|
[#16]: https://github.com/cronofy/cronofy-ruby/pull/16
|
@@ -159,3 +164,4 @@
|
|
159
164
|
[#59]: https://github.com/cronofy/cronofy-ruby/pull/59
|
160
165
|
[#60]: https://github.com/cronofy/cronofy-ruby/pull/60
|
161
166
|
[#62]: https://github.com/cronofy/cronofy-ruby/pull/62
|
167
|
+
[#69]: https://github.com/cronofy/cronofy-ruby/pull/69
|
data/cronofy.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_runtime_dependency "oauth2", "~> 1.0"
|
21
21
|
spec.add_runtime_dependency "hashie", ">= 2.1", "< 4"
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "
|
23
|
+
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.2"
|
26
26
|
spec.add_development_dependency "webmock", "~> 1.21"
|
data/lib/cronofy/client.rb
CHANGED
@@ -1258,7 +1258,7 @@ module Cronofy
|
|
1258
1258
|
# client.upsert_smart_invite(
|
1259
1259
|
# smart_invite_id: "qTtZdczOccgaPncGJaCiLg",
|
1260
1260
|
# callback_url: "http://www.example.com",
|
1261
|
-
#
|
1261
|
+
# recipient: {
|
1262
1262
|
# email: "example@example.com"
|
1263
1263
|
# },
|
1264
1264
|
# event: {
|
@@ -1339,6 +1339,33 @@ module Cronofy
|
|
1339
1339
|
parse_json(SmartInviteResponse, nil, response)
|
1340
1340
|
end
|
1341
1341
|
|
1342
|
+
|
1343
|
+
# Public: Creates an element_token to pass to a UI Element
|
1344
|
+
#
|
1345
|
+
# options - A Hash of options for the token
|
1346
|
+
# :permissions - An Array of strings describing the
|
1347
|
+
# permissions required for the token
|
1348
|
+
# :subs - An Array of sub values for the account(s)
|
1349
|
+
# the element will be accessing
|
1350
|
+
# :origin - The scheme://hostname where the token will
|
1351
|
+
# be used.
|
1352
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
|
1353
|
+
#
|
1354
|
+
# See https://docs.cronofy.com/developers/ui-elements/authentication for
|
1355
|
+
# reference.
|
1356
|
+
#
|
1357
|
+
# Returns an element token
|
1358
|
+
#
|
1359
|
+
# Raises Cronofy::CredentialsMissingError if no credentials available.
|
1360
|
+
# Raises Cronofy::AuthenticationFailureError if the access token is no
|
1361
|
+
# longer valid.
|
1362
|
+
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
1363
|
+
# limits for the application.
|
1364
|
+
def element_token(options)
|
1365
|
+
response = wrapped_request { api_key!.post("/v1/element_tokens", json_request_args(options)) }
|
1366
|
+
parse_json(ElementToken, "element_token", response)
|
1367
|
+
end
|
1368
|
+
|
1342
1369
|
private
|
1343
1370
|
|
1344
1371
|
def translate_available_periods(periods)
|
data/lib/cronofy/types.rb
CHANGED
data/lib/cronofy/version.rb
CHANGED
@@ -1172,6 +1172,70 @@ describe Cronofy::Client do
|
|
1172
1172
|
it_behaves_like 'a Cronofy request with mapped return value'
|
1173
1173
|
end
|
1174
1174
|
|
1175
|
+
describe '#element_token' do
|
1176
|
+
let(:permissions) { ["agenda", "availability"] }
|
1177
|
+
let(:subs) { ["acc_567236000909002", "acc_678347111010113"] }
|
1178
|
+
let(:origin) { "https://local.test/page" }
|
1179
|
+
|
1180
|
+
let(:request_url) { 'https://api.cronofy.com/v1/element_tokens' }
|
1181
|
+
let(:method) { :post }
|
1182
|
+
|
1183
|
+
let(:request_headers) do
|
1184
|
+
{
|
1185
|
+
"Authorization" => "Bearer #{client_secret}",
|
1186
|
+
"User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
|
1187
|
+
"Content-Type" => "application/json; charset=utf-8",
|
1188
|
+
}
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
let(:request_body) do
|
1192
|
+
{
|
1193
|
+
permissions: permissions,
|
1194
|
+
subs: subs,
|
1195
|
+
origin: origin
|
1196
|
+
}
|
1197
|
+
end
|
1198
|
+
|
1199
|
+
let(:expected_token) { "ELEMENT_TOKEN_1276534" }
|
1200
|
+
|
1201
|
+
let(:correct_response_code) { 200 }
|
1202
|
+
let(:correct_response_body) do
|
1203
|
+
{
|
1204
|
+
"element_token" => {
|
1205
|
+
"permissions" => permissions,
|
1206
|
+
"origin" => origin,
|
1207
|
+
"token" => expected_token,
|
1208
|
+
"expires_in" => 64800
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
let(:correct_mapped_result) do
|
1214
|
+
Cronofy::ElementToken.new(correct_response_body['element_token'])
|
1215
|
+
end
|
1216
|
+
|
1217
|
+
let(:client_id) { 'example_id' }
|
1218
|
+
let(:client_secret) { 'example_secret' }
|
1219
|
+
|
1220
|
+
let(:client) do
|
1221
|
+
Cronofy::Client.new(
|
1222
|
+
client_id: client_id,
|
1223
|
+
client_secret: client_secret,
|
1224
|
+
)
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
subject do
|
1228
|
+
client.element_token({
|
1229
|
+
permissions: permissions,
|
1230
|
+
subs: subs,
|
1231
|
+
origin: origin
|
1232
|
+
})
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
it_behaves_like 'a Cronofy request'
|
1236
|
+
it_behaves_like 'a Cronofy request with mapped return value'
|
1237
|
+
end
|
1238
|
+
|
1175
1239
|
describe '#revoke_profile_authorization' do
|
1176
1240
|
let(:request_url) { "https://api.cronofy.com/v1/profiles/#{profile_id}/revoke" }
|
1177
1241
|
let(:method) { :post }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cronofy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergii Paryzhskyi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: oauth2
|
@@ -49,16 +49,22 @@ dependencies:
|
|
49
49
|
name: bundler
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.6'
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3'
|
55
58
|
type: :development
|
56
59
|
prerelease: false
|
57
60
|
version_requirements: !ruby/object:Gem::Requirement
|
58
61
|
requirements:
|
59
|
-
- - "
|
62
|
+
- - ">="
|
60
63
|
- !ruby/object:Gem::Version
|
61
64
|
version: '1.6'
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3'
|
62
68
|
- !ruby/object:Gem::Dependency
|
63
69
|
name: rake
|
64
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
156
|
- !ruby/object:Gem::Version
|
151
157
|
version: '0'
|
152
158
|
requirements: []
|
153
|
-
|
154
|
-
rubygems_version: 2.5.1
|
159
|
+
rubygems_version: 3.0.3
|
155
160
|
signing_key:
|
156
161
|
specification_version: 4
|
157
162
|
summary: Cronofy - one API for all the calendars
|