cronofy 0.37.4 → 0.37.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1338eaab0825a963c74f2c5fd3c434d01185a4bbc36fa57504b0e1edd539fe9e
4
- data.tar.gz: 55a045316dbb1545ee7e4f14284ebbbc0aa7b91848ba28d165968125d2221bb3
3
+ metadata.gz: 72f9a743962bf3c47bdef28e93c0fd4d7cf5fd66101eec219f028ea90fe6291c
4
+ data.tar.gz: ec455881ea2d6df1e86896508453dbcc6d89173275d23a1fe92b565ee01e1144
5
5
  SHA512:
6
- metadata.gz: 38ee7c99226bfe70c6e970a22477de0130e93fe07130b9d2c0a596e17178f66435ec58a97be5f18e9b6ac5624eefef7dde96443a8cc91c85f02818016ed64f7d
7
- data.tar.gz: 8d0d1641e57b0751988ac5f7978571d2dbd6d6ea12b96ff2314a33d0d9b87c7a11eb5e16775c55b070a312c2efb6b8b353dc3c3f7a8cbe9b3f42c943d6afa21a
6
+ metadata.gz: c00a81c85732364c3b6cc384c9bbdc1f10fbacfa756c09959734abbefbe65f58f9de764a8e019f40ba0ec17f4355fb4900c4a457e0cac2d98a0a8dfc653886fd
7
+ data.tar.gz: 6529d3936e84d1721b458bfdfd2acb91585ba7b425d49c7b839f2cdce621d7ae1ba9d1896c471aaecdc6e16474c6f7b0002aa09a64b1390684e5601fa64f35c7
data/CHANGELOG.md CHANGED
@@ -1,22 +1,34 @@
1
+ ## [0.37.7]
2
+
3
+ * Update Gem description
4
+
5
+ ## [0.37.6]
6
+
7
+ * Adds support for disabling and fetching the status of Real-Time Scheduling links [#100]
8
+
9
+ ## [0.37.5]
10
+
11
+ * Support `query_periods` as well as the original `available_periods` for Real-Time Scheduling and Real-Time Sequencing [#99]
12
+
1
13
  ## [0.37.4]
2
14
 
3
- * Support client_secret only clients being able to authorize `#availability` calls. [#97]
15
+ * Support client_secret only clients being able to authorize `#availability` calls. [#97]
4
16
 
5
17
  ## [0.37.3]
6
18
 
7
- * Support `hmac_valid` as well as the original `hmac_match` for Client to verify a HMAC from a push notification using the client's secret.[#95]
19
+ * Support `hmac_valid` as well as the original `hmac_match` for Client to verify a HMAC from a push notification using the client's secret.[#95]
8
20
 
9
21
  ## [0.37.2]
10
22
 
11
- * Support `query_periods` as well as the original `available_periods` for Availability Query and Sequenced Availability [#91]
23
+ * Support `query_periods` as well as the original `available_periods` for Availability Query and Sequenced Availability [#91]
12
24
 
13
25
  ## [0.37.1]
14
26
 
15
- * Rename `data_centre` to `data_centre` (with aliases for backwards compatibility) [#90]
27
+ * Rename `data_centre` to `data_centre` (with aliases for backwards compatibility) [#90]
16
28
 
17
29
  ## [0.37.0]
18
30
 
19
- * Add `revoke_by_token` and `revoke_by_sub` to the Client [#86]
31
+ * Add `revoke_by_token` and `revoke_by_sub` to the Client [#86]
20
32
 
21
33
  ## [0.36.1]
22
34
 
@@ -197,6 +209,9 @@
197
209
  [0.37.2]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.2
198
210
  [0.37.3]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.3
199
211
  [0.37.4]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.4
212
+ [0.37.5]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.5
213
+ [0.37.6]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.6
214
+ [0.37.7]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.7
200
215
 
201
216
  [#13]: https://github.com/cronofy/cronofy-ruby/pull/13
202
217
  [#16]: https://github.com/cronofy/cronofy-ruby/pull/16
@@ -243,3 +258,5 @@
243
258
  [#91]: https://github.com/cronofy/cronofy-ruby/pull/91
244
259
  [#95]: https://github.com/cronofy/cronofy-ruby/pull/95
245
260
  [#97]: https://github.com/cronofy/cronofy-ruby/pull/97
261
+ [#99]: https://github.com/cronofy/cronofy-ruby/pull/99
262
+ [#100]: https://github.com/cronofy/cronofy-ruby/pull/100
data/cronofy.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Sergii Paryzhskyi", "Garry Shutler"]
7
7
  spec.email = ["parizhskiy@gmail.com", "garry@cronofy.com"]
8
8
  spec.summary = %q{Cronofy - the scheduling platform for business}
9
- spec.description = %q{Ruby wrapper for Cronofy's unified calendar API}
9
+ spec.description = %q{SDK for Cronofy - the Scheduling Platform for Business}
10
10
  spec.homepage = "https://github.com/cronofy/cronofy-ruby"
11
11
  spec.license = "MIT"
12
12
 
@@ -1033,7 +1033,7 @@ module Cronofy
1033
1033
  # call
1034
1034
  # :required_duration - A hash stating the length of time the event will
1035
1035
  # last for
1036
- # :available_periods - A hash stating the available periods for the event
1036
+ # :query_periods - A hash stating the available periods for the event
1037
1037
  # :start_interval - An Integer representing the start interval
1038
1038
  # of minutes for the availability query.
1039
1039
  # :buffer - An Hash containing the buffer to apply to
@@ -1069,7 +1069,7 @@ module Cronofy
1069
1069
  # }
1070
1070
  # ],
1071
1071
  # required_duration: { minutes: 60 },
1072
- # available_periods: [{
1072
+ # query_periods: [{
1073
1073
  # start: Time.utc(2017, 1, 1, 9, 00),
1074
1074
  # end: Time.utc(2017, 1, 1, 17, 00),
1075
1075
  # }]
@@ -1110,13 +1110,66 @@ module Cronofy
1110
1110
  end
1111
1111
  end
1112
1112
 
1113
- translate_available_periods(availability[:available_periods])
1113
+ translate_available_periods(availability[:query_periods] || availability[:available_periods])
1114
1114
  body[:availability] = availability
1115
1115
 
1116
1116
  response = raw_post("/v1/real_time_scheduling", body)
1117
1117
  parse_json(AddToCalendarResponse, nil , response)
1118
1118
  end
1119
1119
 
1120
+ # Public: Gets the status of a Real-Time Scheduling link.
1121
+ #
1122
+ # Provide one of the following arguments to identify the link:
1123
+ # id - A String uniquely identifying the link, returned on initial
1124
+ # creation
1125
+ # token - The token portion of the link's URL
1126
+ #
1127
+ # See https://docs.cronofy.com/developers/api/scheduling/real-time-scheduling/status/ for reference.
1128
+ #
1129
+ # Returns a RealTimeSchedulingStatus.
1130
+ #
1131
+ # Raises ArgumentError if neither 'id' nor 'token' arguments are passed.
1132
+ # Raises Cronofy::CredentialsMissingError if no credentials available.
1133
+ # Raises Cronofy::TooManyRequestsError if the request exceeds the rate
1134
+ # limits for the application.
1135
+ def get_real_time_scheduling_status(args = {})
1136
+ if args[:token]
1137
+ url = "/v1/real_time_scheduling?token=#{args[:token]}"
1138
+ elsif args[:id]
1139
+ url = "/v1/real_time_scheduling/#{args[:id]}"
1140
+ else
1141
+ raise ArgumentError.new("Must pass either token or id argument")
1142
+ end
1143
+
1144
+ response = wrapped_request { api_key!.get(url) }
1145
+ parse_json(RealTimeSchedulingStatus, 'real_time_scheduling' , response)
1146
+ end
1147
+
1148
+ # Public: Disables a Real-Time Scheduling link.
1149
+ #
1150
+ # id - A String uniquely identifying the link, returned
1151
+ # on initial creation
1152
+ # display_message - A message to display to visitors of the disabled link
1153
+ #
1154
+ # See https://docs.cronofy.com/developers/api/scheduling/real-time-scheduling/disable/ for reference.
1155
+ #
1156
+ # Returns a RealTimeSchedulingStatus.
1157
+ #
1158
+ # Raises ArgumentError if no 'id' argument is passed.
1159
+ # Raises Cronofy::CredentialsMissingError if no credentials available.
1160
+ # Raises Cronofy::InvalidRequestError if the request contains invalid
1161
+ # parameters.
1162
+ # Raises Cronofy::TooManyRequestsError if the request exceeds the rate
1163
+ # limits for the application.
1164
+ def disable_real_time_scheduling(args = {})
1165
+ id = args.delete(:id)
1166
+
1167
+ raise ArgumentError.new('id argument is required') unless id
1168
+
1169
+ response = wrapped_request { api_key!.post("/v1/real_time_scheduling/#{id}/disable", json_request_args(args)) }
1170
+ parse_json(RealTimeSchedulingStatus, 'real_time_scheduling' , response)
1171
+ end
1172
+
1120
1173
  # Public: Generates an real time sequencing link to start the OAuth process with
1121
1174
  # an event to be automatically upserted
1122
1175
  #
@@ -1176,7 +1229,7 @@ module Cronofy
1176
1229
  # an array of invitees to invite to or reject from
1177
1230
  # the event. Invitees are represented by a hash of
1178
1231
  # :email and :display_name (optional).
1179
- # :available_periods - A hash stating the available periods for the event
1232
+ # :query_periods - A hash stating the query periods for the event
1180
1233
  # target_calendars - An array of hashes stating into which calendars to insert the created
1181
1234
  # event
1182
1235
  # Raises Cronofy::CredentialsMissingError if no credentials available.
@@ -1194,7 +1247,8 @@ module Cronofy
1194
1247
 
1195
1248
  if availability = args[:availability]
1196
1249
  availability[:sequence] = map_availability_sequence(availability[:sequence])
1197
- translate_available_periods(availability[:available_periods]) if availability[:available_periods]
1250
+ periods = availability[:query_periods] || availability[:available_periods]
1251
+ translate_available_periods(periods) if periods
1198
1252
  end
1199
1253
 
1200
1254
  body[:availability] = availability
@@ -1748,8 +1802,10 @@ module Cronofy
1748
1802
  hash[:required_duration] = map_availability_required_duration(value)
1749
1803
  end
1750
1804
 
1751
- if sequence_item[:available_periods]
1752
- translate_available_periods(sequence_item[:available_periods])
1805
+ periods = sequence_item[:query_periods] || sequence_item[:available_periods]
1806
+
1807
+ if periods
1808
+ translate_available_periods(periods)
1753
1809
  end
1754
1810
 
1755
1811
  if value = sequence_item[:start_interval]
data/lib/cronofy/types.rb CHANGED
@@ -413,4 +413,8 @@ module Cronofy
413
413
  class AvailabilityRule < CronofyMash
414
414
  coerce_key :weekly_periods, WeeklyPeriodEnumerable
415
415
  end
416
+
417
+ class RealTimeSchedulingStatus < CronofyMash
418
+ coerce_key :event, Event
419
+ end
416
420
  end
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.37.4".freeze
2
+ VERSION = "0.37.7".freeze
3
3
  end
@@ -2190,25 +2190,8 @@ describe Cronofy::Client do
2190
2190
  end
2191
2191
 
2192
2192
  describe "Real time scheduling" do
2193
- let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling" }
2194
- let(:url) { URI("https://example.com") }
2195
- let(:method) { :post }
2196
-
2197
- let(:request_headers) do
2198
- {
2199
- "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
2200
- "Content-Type" => "application/json; charset=utf-8",
2201
- }
2202
- end
2203
-
2204
- let(:location) { { :description => "Board room" } }
2205
- let(:transparency) { nil }
2206
2193
  let(:client_id) { 'example_id' }
2207
2194
  let(:client_secret) { 'example_secret' }
2208
- let(:scope) { 'read_events delete_events' }
2209
- let(:state) { 'example_state' }
2210
- let(:redirect_uri) { 'http://example.com/redirect' }
2211
-
2212
2195
  let(:client) do
2213
2196
  Cronofy::Client.new(
2214
2197
  client_id: client_id,
@@ -2216,6 +2199,9 @@ describe Cronofy::Client do
2216
2199
  )
2217
2200
  end
2218
2201
 
2202
+ let(:url) { URI("https://example.com") }
2203
+ let(:location) { { :description => "Board room" } }
2204
+ let(:transparency) { nil }
2219
2205
  let(:event) do
2220
2206
  {
2221
2207
  :event_id => "qTtZdczOccgaPncGJaCiLg",
@@ -2232,115 +2218,253 @@ describe Cronofy::Client do
2232
2218
  }
2233
2219
  end
2234
2220
 
2235
- let(:oauth_body) do
2221
+ let(:real_time_scheduling_status_response) do
2236
2222
  {
2237
- scope: scope,
2238
- redirect_uri: redirect_uri,
2239
- state: state,
2223
+ real_time_scheduling: {
2224
+ real_time_scheduling_id: 'example_id',
2225
+ url: 'https://app.cronofy.com/real_time_scheduling/example_token',
2226
+ event: event,
2227
+ status: 'disabled',
2228
+ }
2240
2229
  }
2241
2230
  end
2242
2231
 
2243
- let(:target_calendars) do
2244
- [
2232
+ describe "#real_time_scheduling" do
2233
+ let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling" }
2234
+
2235
+ let(:method) { :post }
2236
+
2237
+ let(:request_headers) do
2245
2238
  {
2246
- sub: "acc_567236000909002",
2247
- calendar_id: "cal_n23kjnwrw2_jsdfjksn234",
2239
+ "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
2240
+ "Content-Type" => "application/json; charset=utf-8",
2248
2241
  }
2249
- ]
2250
- end
2242
+ end
2251
2243
 
2252
- let(:availability) do
2253
- {
2254
- participants: [
2244
+ let(:scope) { 'read_events delete_events' }
2245
+ let(:state) { 'example_state' }
2246
+ let(:redirect_uri) { 'http://example.com/redirect' }
2247
+
2248
+ let(:oauth_body) do
2249
+ {
2250
+ scope: scope,
2251
+ redirect_uri: redirect_uri,
2252
+ state: state,
2253
+ }
2254
+ end
2255
+
2256
+ let(:target_calendars) do
2257
+ [
2255
2258
  {
2256
- members: [{
2257
- sub: "acc_567236000909002",
2258
- calendar_ids: ["cal_n23kjnwrw2_jsdfjksn234"]
2259
- }],
2260
- required: 'all'
2259
+ sub: "acc_567236000909002",
2260
+ calendar_id: "cal_n23kjnwrw2_jsdfjksn234",
2261
+ }
2262
+ ]
2263
+ end
2264
+
2265
+ let(:availability) do
2266
+ {
2267
+ participants: [
2268
+ {
2269
+ members: [{
2270
+ sub: "acc_567236000909002",
2271
+ calendar_ids: ["cal_n23kjnwrw2_jsdfjksn234"]
2272
+ }],
2273
+ required: 'all'
2274
+ }
2275
+ ],
2276
+ required_duration: { minutes: 60 },
2277
+ available_periods: [{
2278
+ start: Time.utc(2017, 1, 1, 9, 00),
2279
+ end: Time.utc(2017, 1, 1, 17, 00),
2280
+ }],
2281
+ start_interval: { minutes: 60 },
2282
+ buffer: {
2283
+ before: { minutes: 30 },
2284
+ after: { minutes: 45 },
2261
2285
  }
2262
- ],
2263
- required_duration: { minutes: 60 },
2264
- available_periods: [{
2265
- start: Time.utc(2017, 1, 1, 9, 00),
2266
- end: Time.utc(2017, 1, 1, 17, 00),
2267
- }],
2268
- start_interval: { minutes: 60 },
2269
- buffer: {
2270
- before: { minutes: 30 },
2271
- after: { minutes: 45 },
2272
2286
  }
2273
- }
2287
+ end
2288
+
2289
+ let(:mapped_availability) do
2290
+ {
2291
+ participants: [
2292
+ {
2293
+ members: [{
2294
+ sub: "acc_567236000909002",
2295
+ calendar_ids: ["cal_n23kjnwrw2_jsdfjksn234"]
2296
+ }],
2297
+ required: 'all'
2298
+ }
2299
+ ],
2300
+ required_duration: { minutes: 60 },
2301
+ start_interval: { minutes: 60 },
2302
+ buffer: {
2303
+ before: { minutes: 30 },
2304
+ after: { minutes: 45 },
2305
+ },
2306
+ available_periods: [{
2307
+ start: "2017-01-01T09:00:00Z",
2308
+ end: "2017-01-01T17:00:00Z",
2309
+ }]
2310
+ }
2311
+ end
2312
+
2313
+ let(:args) do
2314
+ {
2315
+ oauth: oauth_body,
2316
+ event: event,
2317
+ target_calendars: target_calendars,
2318
+ availability: availability,
2319
+ }
2320
+ end
2321
+
2322
+ let(:request_body) do
2323
+ {
2324
+ client_id: client_id,
2325
+ client_secret: client_secret,
2326
+ oauth: oauth_body,
2327
+ event: {
2328
+ :event_id => "qTtZdczOccgaPncGJaCiLg",
2329
+ :summary => "Board meeting",
2330
+ :description => "Discuss plans for the next quarter.",
2331
+ :url => url.to_s,
2332
+ :location => location,
2333
+ :transparency => transparency,
2334
+ :reminders => [
2335
+ { :minutes => 60 },
2336
+ { :minutes => 0 },
2337
+ { :minutes => 10 },
2338
+ ],
2339
+ },
2340
+ target_calendars: target_calendars,
2341
+ availability: mapped_availability,
2342
+ }
2343
+ end
2344
+ let(:correct_response_code) { 202 }
2345
+ let(:correct_response_body) do
2346
+ {
2347
+ oauth_url: "http://www.example.com/oauth?token=example"
2348
+ }
2349
+ end
2350
+
2351
+ subject { client.real_time_scheduling(args) }
2352
+
2353
+ context 'when start/end are Times' do
2354
+ it_behaves_like 'a Cronofy request'
2355
+ end
2356
+
2357
+ context 'when passing query periods' do
2358
+ it_behaves_like 'a Cronofy request'
2359
+
2360
+ before do
2361
+ availability[:query_periods] = availability.delete(:available_periods)
2362
+ mapped_availability[:query_periods] = mapped_availability.delete(:available_periods)
2363
+ end
2364
+ end
2274
2365
  end
2275
2366
 
2276
- let(:mapped_availability) do
2277
- {
2278
- participants: [
2367
+ describe "#get_real_time_scheduling_status" do
2368
+ let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling" }
2369
+ let(:method) { :get }
2370
+ let(:url) { "https://example.com" }
2371
+ let(:request_headers) do
2372
+ {
2373
+ "Authorization" => "Bearer #{client_secret}",
2374
+ "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
2375
+ "Accept" => "*/*",
2376
+ "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
2377
+ }
2378
+ end
2379
+ let(:correct_response_code) { 200 }
2380
+ let(:correct_response_body) { real_time_scheduling_status_response }
2381
+ let(:correct_mapped_result) do
2382
+ Cronofy::RealTimeSchedulingStatus.new(correct_response_body[:real_time_scheduling])
2383
+ end
2384
+
2385
+ subject { client.get_real_time_scheduling_status(args) }
2386
+
2387
+ context 'when passing id' do
2388
+ let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling/example_id" }
2389
+
2390
+ let(:args) do
2279
2391
  {
2280
- members: [{
2281
- sub: "acc_567236000909002",
2282
- calendar_ids: ["cal_n23kjnwrw2_jsdfjksn234"]
2283
- }],
2284
- required: 'all'
2392
+ id: 'example_id'
2285
2393
  }
2286
- ],
2287
- required_duration: { minutes: 60 },
2288
- start_interval: { minutes: 60 },
2289
- buffer: {
2290
- before: { minutes: 30 },
2291
- after: { minutes: 45 },
2292
- },
2293
- available_periods: [{
2294
- start: "2017-01-01T09:00:00Z",
2295
- end: "2017-01-01T17:00:00Z",
2296
- }]
2297
- }
2298
- end
2394
+ end
2299
2395
 
2300
- let(:args) do
2301
- {
2302
- oauth: oauth_body,
2303
- event: event,
2304
- target_calendars: target_calendars,
2305
- availability: availability,
2306
- }
2307
- end
2396
+ it_behaves_like 'a Cronofy request'
2397
+ it_behaves_like 'a Cronofy request with mapped return value'
2398
+ end
2308
2399
 
2309
- let(:request_body) do
2310
- {
2311
- client_id: client_id,
2312
- client_secret: client_secret,
2313
- oauth: oauth_body,
2314
- event: {
2315
- :event_id => "qTtZdczOccgaPncGJaCiLg",
2316
- :summary => "Board meeting",
2317
- :description => "Discuss plans for the next quarter.",
2318
- :url => url.to_s,
2319
- :location => location,
2320
- :transparency => transparency,
2321
- :reminders => [
2322
- { :minutes => 60 },
2323
- { :minutes => 0 },
2324
- { :minutes => 10 },
2325
- ],
2326
- },
2327
- target_calendars: target_calendars,
2328
- availability: mapped_availability,
2329
- }
2330
- end
2331
- let(:correct_response_code) { 202 }
2332
- let(:correct_response_body) do
2333
- {
2334
- oauth_url: "http://www.example.com/oauth?token=example"
2335
- }
2400
+ context 'when passing token' do
2401
+ let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling?token=example_token" }
2402
+ let(:args) do
2403
+ {
2404
+ token: 'example_token'
2405
+ }
2406
+ end
2407
+
2408
+ it_behaves_like 'a Cronofy request'
2409
+ it_behaves_like 'a Cronofy request with mapped return value'
2410
+ end
2411
+
2412
+ context 'when passing neither id nor token' do
2413
+ let(:args) { Hash.new }
2414
+ it 'raises an ArgumentError' do
2415
+ expect { subject }.to raise_error(ArgumentError)
2416
+ end
2417
+ end
2336
2418
  end
2337
2419
 
2338
- subject { client.real_time_scheduling(args) }
2420
+ describe "#disable_real_time_scheduling" do
2421
+ let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling/example_id/disable" }
2422
+ let(:url) { "https://example.com" }
2423
+ let(:method) { :post }
2424
+ let(:request_headers) do
2425
+ {
2426
+ "Authorization" => "Bearer #{client_secret}",
2427
+ "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
2428
+ "Content-Type" => "application/json; charset=utf-8",
2429
+ }
2430
+ end
2431
+
2432
+ let(:args) do
2433
+ {
2434
+ id: 'example_id',
2435
+ display_message: 'example message'
2436
+ }
2437
+ end
2438
+
2439
+ let(:request_body) do
2440
+ {
2441
+ display_message: 'example message'
2442
+ }
2443
+ end
2444
+
2445
+ let(:correct_response_code) { 200 }
2446
+ let(:correct_response_body) { real_time_scheduling_status_response }
2447
+ let(:correct_mapped_result) do
2448
+ Cronofy::RealTimeSchedulingStatus.new(correct_response_body[:real_time_scheduling])
2449
+ end
2450
+
2451
+ subject { client.disable_real_time_scheduling(args) }
2339
2452
 
2340
- context 'when start/end are Times' do
2341
2453
  it_behaves_like 'a Cronofy request'
2342
- end
2454
+ it_behaves_like 'a Cronofy request with mapped return value'
2343
2455
 
2456
+ context 'when omitting id argument' do
2457
+ let(:args) do
2458
+ {
2459
+ display_message: 'example message'
2460
+ }
2461
+ end
2462
+
2463
+ it 'raises an ArgumentError' do
2464
+ expect { subject }.to raise_error(ArgumentError)
2465
+ end
2466
+ end
2467
+ end
2344
2468
  end
2345
2469
 
2346
2470
  describe "Real time sequencing" do
@@ -2529,6 +2653,21 @@ describe Cronofy::Client do
2529
2653
  it_behaves_like 'a Cronofy request'
2530
2654
  end
2531
2655
 
2656
+ context 'when passing query periods' do
2657
+ it_behaves_like 'a Cronofy request'
2658
+
2659
+ before do
2660
+ availability[:query_periods] = availability.delete(:available_periods)
2661
+ availability[:sequence].each do |sequence|
2662
+ sequence[:query_periods] = sequence.delete(:available_periods)
2663
+ end
2664
+
2665
+ mapped_availability[:query_periods] = mapped_availability.delete(:available_periods)
2666
+ mapped_availability[:sequence].each do |sequence|
2667
+ sequence[:query_periods] = sequence.delete(:available_periods)
2668
+ end
2669
+ end
2670
+ end
2532
2671
  end
2533
2672
 
2534
2673
  describe "specifying data_centre" do
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.37.4
4
+ version: 0.37.7
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: 2022-03-10 00:00:00.000000000 Z
12
+ date: 2022-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -107,7 +107,7 @@ dependencies:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: 3.9.1
110
- description: Ruby wrapper for Cronofy's unified calendar API
110
+ description: SDK for Cronofy - the Scheduling Platform for Business
111
111
  email:
112
112
  - parizhskiy@gmail.com
113
113
  - garry@cronofy.com
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.2.32
159
+ rubygems_version: 3.3.11
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Cronofy - the scheduling platform for business