cronofy 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f999ccb12faff1b50ff5f6069670c5edaeecdba
4
- data.tar.gz: a5eb234959601811c9518e60ee7f614b4e9a658c
3
+ metadata.gz: 522370b2f01af27ff60bacbb76323ca47dd077b1
4
+ data.tar.gz: 716a6013058ba2216fe70ac96b755bc6533ba24e
5
5
  SHA512:
6
- metadata.gz: 3317567d3489c8d7621f99e3deb35a40dd08854ff19d14a5919bb89a6d21d59fc2a55f14e602f3bb1d39c7f1d8d559d9044708f4bf475f7bf1c69687f9422386
7
- data.tar.gz: ef28b30f3a07e251ba34a785e87e849cb0b3deae030438a2ecaac9d4a1d3091b4187c5077c94ae22df40de47fb22e5021e1da4cf24caa4bbec15d7620256f74e
6
+ metadata.gz: b8bdf1cbb735736f76700aad41b083be051b5d821e03a088c54b537c066743ee51390fc73daa6875b8ecc78ee22e5c6c127d8b94532ee3af0b492cd4270b8acf
7
+ data.tar.gz: 5bb3db55ed8cd3e9f71320bdb13f1e754d9f9bf47b049d8d87c3a2be74fc668c4c21c0f352fb4147ef1bd54762b39c03e2f004b6ade724ba9ff3f0011b4c04fb
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
+ ## [0.20.0]
2
+
3
+ * Change invalid request message to include errors [#36]
4
+ * Pass through times as-is if already Strings [#37]
5
+ * Support bulk delete from specific calendars [#38]
6
+
1
7
  ## [0.19.0]
2
8
 
3
- * Support add to calendar #31]
9
+ * Support setting event transparency [#31]
10
+ * Support Add To Calendar [#35]
4
11
 
5
12
  ## [0.18.0]
6
13
 
@@ -45,6 +52,7 @@
45
52
  [0.17.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.17.0
46
53
  [0.18.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.18.0
47
54
  [0.19.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.19.0
55
+ [0.20.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.20.0
48
56
 
49
57
  [#13]: https://github.com/cronofy/cronofy-ruby/pull/13
50
58
  [#16]: https://github.com/cronofy/cronofy-ruby/pull/16
@@ -56,3 +64,7 @@
56
64
  [#27]: https://github.com/cronofy/cronofy-ruby/pull/27
57
65
  [#30]: https://github.com/cronofy/cronofy-ruby/pull/30
58
66
  [#31]: https://github.com/cronofy/cronofy-ruby/pull/31
67
+ [#35]: https://github.com/cronofy/cronofy-ruby/pull/35
68
+ [#36]: https://github.com/cronofy/cronofy-ruby/pull/36
69
+ [#37]: https://github.com/cronofy/cronofy-ruby/pull/37
70
+ [#38]: https://github.com/cronofy/cronofy-ruby/pull/38
@@ -330,9 +330,16 @@ module Cronofy
330
330
 
331
331
  # Public: Deletes all events you are managing for the account.
332
332
  #
333
- # See http://www.cronofy.com/developers/api/alpha#bulk-delete-events for
333
+ # See https://www.cronofy.com/developers/api/#bulk-delete-events for
334
334
  # reference.
335
335
  #
336
+ # options - The Hash options used to refine the selection (optional):
337
+ # :calendar_ids - An Array of calendar ids to delete managed
338
+ # events from returned events.
339
+ #
340
+ # If no options are specified it defaults to deleting all the events you are
341
+ # managing.
342
+ #
336
343
  # Returns nothing.
337
344
  #
338
345
  # Raises Cronofy::CredentialsMissingError if no credentials available.
@@ -345,8 +352,9 @@ module Cronofy
345
352
  # parameters.
346
353
  # Raises Cronofy::TooManyRequestsError if the request exceeds the rate
347
354
  # limits for the application.
348
- def delete_all_events
349
- delete("/v1/events", delete_all: true)
355
+ def delete_all_events(options = nil)
356
+ options ||= { delete_all: true }
357
+ delete("/v1/events", options)
350
358
  nil
351
359
  end
352
360
 
@@ -939,6 +947,8 @@ module Cronofy
939
947
  result = time
940
948
 
941
949
  case time
950
+ when String
951
+ time
942
952
  when Hash
943
953
  if time[:time]
944
954
  encoded_time = encode_event_time(time[:time])
@@ -42,6 +42,10 @@ module Cronofy
42
42
  end
43
43
 
44
44
  class InvalidRequestError < APIError
45
+ def message
46
+ "#{super} - #{errors.inspect}"
47
+ end
48
+
45
49
  def errors
46
50
  @errors ||= begin
47
51
  json = JSON.parse(self.body)
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.19.0".freeze
2
+ VERSION = "0.20.0".freeze
3
3
  end
@@ -319,6 +319,13 @@ describe Cronofy::Client do
319
319
 
320
320
  it_behaves_like 'a Cronofy request'
321
321
  end
322
+
323
+ context 'when start and end already encoded' do
324
+ let(:start_datetime) { encoded_start_datetime }
325
+ let(:end_datetime) { encoded_end_datetime }
326
+
327
+ it_behaves_like 'a Cronofy request'
328
+ end
322
329
  end
323
330
 
324
331
  describe '#read_events' do
@@ -594,16 +601,32 @@ describe Cronofy::Client do
594
601
  end
595
602
 
596
603
  describe '#delete_all_events' do
597
- let(:request_url) { "https://api.cronofy.com/v1/events" }
598
- let(:method) { :delete }
599
- let(:request_headers) { json_request_headers }
600
- let(:request_body) { { :delete_all => true } }
601
- let(:correct_response_code) { 202 }
602
- let(:correct_response_body) { nil }
604
+ context "default" do
605
+ let(:request_url) { "https://api.cronofy.com/v1/events" }
606
+ let(:method) { :delete }
607
+ let(:request_headers) { json_request_headers }
608
+ let(:request_body) { { :delete_all => true } }
609
+ let(:correct_response_code) { 202 }
610
+ let(:correct_response_body) { nil }
603
611
 
604
- subject { client.delete_all_events }
612
+ subject { client.delete_all_events }
605
613
 
606
- it_behaves_like 'a Cronofy request'
614
+ it_behaves_like 'a Cronofy request'
615
+ end
616
+
617
+ context "specific calendars" do
618
+ let(:calendar_ids) { %w{cal_1234_5678 cal_abcd_efgh} }
619
+ let(:request_url) { "https://api.cronofy.com/v1/events" }
620
+ let(:method) { :delete }
621
+ let(:request_headers) { json_request_headers }
622
+ let(:request_body) { { :calendar_ids => calendar_ids } }
623
+ let(:correct_response_code) { 202 }
624
+ let(:correct_response_body) { nil }
625
+
626
+ subject { client.delete_all_events(calendar_ids: calendar_ids) }
627
+
628
+ it_behaves_like 'a Cronofy request'
629
+ end
607
630
  end
608
631
  end
609
632
 
@@ -50,6 +50,10 @@ describe Cronofy::Errors do
50
50
 
51
51
  expect(subject.errors).to eq(deserialized_errors)
52
52
  end
53
+
54
+ it "includes the errors in the message" do
55
+ expect(subject.message).to eq('message - {"event_id"=>[{"key"=>"errors.required", "description"=>"required"}]}')
56
+ end
53
57
  end
54
58
 
55
59
  context "errors field missing" 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.19.0
4
+ version: 0.20.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: 2017-04-07 00:00:00.000000000 Z
12
+ date: 2017-04-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.6.8
152
+ rubygems_version: 2.6.6
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Cronofy - one API for all the calendars