cronofy 0.28.1 → 0.29.0

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
  SHA1:
3
- metadata.gz: 8f7607f0763fdf35ba91690652f61035e959b152
4
- data.tar.gz: a84fe222d76977a96fac6a9d93a17f5dd3a84ae8
3
+ metadata.gz: ed8c9e154c5eba55604233b0d6c521fcce77288e
4
+ data.tar.gz: c2a0fd0f4d6ea9413cbe802de3c98ec8ef491e54
5
5
  SHA512:
6
- metadata.gz: 174b27c105dae5e28e72f2d332efaa5c59848829df75ee002a031a092d28e6bf99596458d6aa5a0e1545f74a6e0a86eab973ddf321e80eb739832db9137c1a3a
7
- data.tar.gz: 17ce4ddb925177ecc8b1106124895d6c7631eecfcde1d7907078e3828022d776ed0f9faa9b4a571a0d538dd0e9ae32da28c14647850abdb5f615fdcb877c2c39
6
+ metadata.gz: 80ae8094e1805000f4882d3ead3d2f7badf99e4ac080a76833ae1386ef718768a96f4314b8848740056ca6acd2b59890c9463820472e151d9072c314e70d3af8
7
+ data.tar.gz: e91f2eca9e6916ec8db19e931dcf5813da98c99acb682a702a75fd9bfe3262d991cbfde6f40659d0cb5546125412a5c04857570aa746c8b3cd0f52e1b24156a6
@@ -1,3 +1,7 @@
1
+ ## [0.29.0]
2
+
3
+ * Added types for propose new time replies [#60]
4
+
1
5
  ## [0.28.1]
2
6
 
3
7
  * Fixed double encoding issue [#59]
@@ -116,6 +120,7 @@
116
120
  [0.27.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.27.0
117
121
  [0.28.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.28.0
118
122
  [0.28.1]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.28.1
123
+ [0.29.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.29.0
119
124
 
120
125
  [#13]: https://github.com/cronofy/cronofy-ruby/pull/13
121
126
  [#16]: https://github.com/cronofy/cronofy-ruby/pull/16
@@ -146,3 +151,4 @@
146
151
  [#57]: https://github.com/cronofy/cronofy-ruby/pull/57
147
152
  [#58]: https://github.com/cronofy/cronofy-ruby/pull/58
148
153
  [#59]: https://github.com/cronofy/cronofy-ruby/pull/59
154
+ [#60]: https://github.com/cronofy/cronofy-ruby/pull/60
@@ -328,7 +328,24 @@ module Cronofy
328
328
  class AddToCalendarResponse < CronofyMash
329
329
  end
330
330
 
331
+ class Proposal < CronofyMash
332
+ coerce_key :start, EventTime
333
+ coerce_key :end, EventTime
334
+ end
335
+
336
+ class SmartInviteReply < CronofyMash
337
+ coerce_key :proposal, Proposal
338
+ end
339
+
340
+ module SmartInviteReplyEnumerable
341
+ def self.coerce(values)
342
+ values.map { |v| SmartInviteReply.new(v) }
343
+ end
344
+ end
345
+
331
346
  class SmartInviteResponse < CronofyMash
347
+ coerce_key :recipient, SmartInviteReply
348
+ coerce_key :replies, SmartInviteReplyEnumerable
332
349
  end
333
350
 
334
351
  module ParticipantEnumerable
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.28.1".freeze
2
+ VERSION = "0.29.0".freeze
3
3
  end
@@ -1902,6 +1902,110 @@ describe Cronofy::Client do
1902
1902
 
1903
1903
  end
1904
1904
 
1905
+ describe 'Read smart invite' do
1906
+ before do
1907
+ stub_request(method, request_url)
1908
+ .with(headers: request_headers)
1909
+ .to_return(status: correct_response_code,
1910
+ headers: correct_response_headers,
1911
+ body: correct_response_body.to_json)
1912
+ end
1913
+
1914
+ let(:request_headers) do
1915
+ {
1916
+ "Authorization" => "Bearer #{client_secret}",
1917
+ "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}",
1918
+ "Accept" => "*/*",
1919
+ "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
1920
+ }
1921
+ end
1922
+
1923
+ let(:client_id) { 'example_id' }
1924
+ let(:client_secret) { 'example_secret' }
1925
+
1926
+ let(:client) do
1927
+ Cronofy::Client.new(
1928
+ client_id: client_id,
1929
+ client_secret: client_secret,
1930
+ )
1931
+ end
1932
+
1933
+ let(:request_url_prefix) { 'https://api.cronofy.com/v1/smart_invites' }
1934
+ let(:method) { :get }
1935
+ let(:correct_response_code) { 200 }
1936
+ let(:smart_invite_id) { "smart_invite_id_1234" }
1937
+ let(:recipient_email) { "example@example.com" }
1938
+ let(:request_url) { request_url_prefix + "?recipient_email=#{recipient_email}&smart_invite_id=#{smart_invite_id}" }
1939
+
1940
+ let(:correct_response_body) do
1941
+ {
1942
+ "recipient" => {
1943
+ "email" => recipient_email,
1944
+ "status" => "declined",
1945
+ "comment" => "example comment",
1946
+ "proposal" => {
1947
+ "start" => {
1948
+ "time" => "2014-09-13T23:00:00+02:00",
1949
+ "tzid" => "Europe/Paris"
1950
+ },
1951
+ "end" => {
1952
+ "time" => "2014-09-13T23:00:00+02:00",
1953
+ "tzid" => "Europe/Paris"
1954
+ }
1955
+ }
1956
+ },
1957
+ "replies" => [
1958
+ {
1959
+ "email" => "person1@example.com",
1960
+ "status" => "accepted"
1961
+ },
1962
+ {
1963
+ "email" => "person2@example.com",
1964
+ "status" => "declined",
1965
+ "comment" => "example comment",
1966
+ "proposal" => {
1967
+ "start" => {
1968
+ "time" => "2014-09-13T23:00:00+02:00",
1969
+ "tzid" => "Europe/Paris"
1970
+ },
1971
+ "end" => {
1972
+ "time" => "2014-09-13T23:00:00+02:00",
1973
+ "tzid" => "Europe/Paris"
1974
+ }
1975
+ }
1976
+ }
1977
+ ],
1978
+ "smart_invite_id" => smart_invite_id,
1979
+ "callback_url" => "https =>//example.yourapp.com/cronofy/smart_invite/notifications",
1980
+ "event" => {
1981
+ "summary" => "Board meeting",
1982
+ "description" => "Discuss plans for the next quarter.",
1983
+ "start" => {
1984
+ "time" => "2017-10-05T09:30:00Z",
1985
+ "tzid" => "Europe/London"
1986
+ },
1987
+ "end" => {
1988
+ "time" => "2017-10-05T10:00:00Z",
1989
+ "tzid" => "Europe/London"
1990
+ },
1991
+ "location" => {
1992
+ "description" => "Board room"
1993
+ }
1994
+ }
1995
+ }
1996
+ end
1997
+
1998
+ let(:correct_mapped_result) do
1999
+ Cronofy::SmartInviteResponse.new(correct_response_body)
2000
+ end
2001
+
2002
+ subject do
2003
+ client.get_smart_invite(smart_invite_id, recipient_email)
2004
+ end
2005
+
2006
+ it_behaves_like 'a Cronofy request'
2007
+ it_behaves_like 'a Cronofy request with mapped return value'
2008
+ end
1905
2009
 
1906
2010
  describe "Cancel Smart Invite" do
1907
2011
  let(:request_url) { "https://api.cronofy.com/v1/smart_invites" }
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.28.1
4
+ version: 0.29.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: 2018-02-27 00:00:00.000000000 Z
12
+ date: 2018-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth2
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.6.6
154
+ rubygems_version: 2.5.1
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Cronofy - one API for all the calendars