cronofy 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/cronofy/client.rb +102 -18
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/client_spec.rb +25 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48c75251078b9b71b6921cb317f6691a9add421
|
4
|
+
data.tar.gz: b616264212a442276812c5a4a8d944d34e4ba500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18fb8765fa73771e8b19fdd58e6d349dd792cc82d9e2f8cc817341722e461b74e2d28d7133ddae470ff58cf41441d9dc6b77db118de23e7383586dfa3a44cd61
|
7
|
+
data.tar.gz: 39a63b0cdf4d63ce838fdbac5bb94d5f8bf6e3cf37b7102760b4f925f4adcfd12b08224dd64a8ce6c570a299074a8f1f4e4529badfb61102c94f96e8c1fcaa45
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## [0.22.0]
|
2
|
+
|
3
|
+
* Splitting of Add to Calendar and Real time scheduling [#44]
|
4
|
+
* Support for explicit linking of accounts [#43]
|
5
|
+
|
1
6
|
## [0.21.0]
|
2
7
|
|
3
8
|
* Support Add To Calendar with availability [#40]
|
@@ -57,7 +62,8 @@
|
|
57
62
|
[0.18.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.18.0
|
58
63
|
[0.19.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.19.0
|
59
64
|
[0.20.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.20.0
|
60
|
-
[0.21.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.
|
65
|
+
[0.21.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.21.0
|
66
|
+
[0.22.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.22.0
|
61
67
|
|
62
68
|
[#13]: https://github.com/cronofy/cronofy-ruby/pull/13
|
63
69
|
[#16]: https://github.com/cronofy/cronofy-ruby/pull/16
|
@@ -74,3 +80,5 @@
|
|
74
80
|
[#37]: https://github.com/cronofy/cronofy-ruby/pull/37
|
75
81
|
[#38]: https://github.com/cronofy/cronofy-ruby/pull/38
|
76
82
|
[#40]: https://github.com/cronofy/cronofy-ruby/pull/40
|
83
|
+
[#43]: https://github.com/cronofy/cronofy-ruby/pull/43
|
84
|
+
[#44]: https://github.com/cronofy/cronofy-ruby/pull/44
|
data/lib/cronofy/client.rb
CHANGED
@@ -754,18 +754,9 @@ module Cronofy
|
|
754
754
|
# an array of invitees to invite to or reject from
|
755
755
|
# the event. Invitees are represented by a hash of
|
756
756
|
# :email and :display_name (optional).
|
757
|
-
# availability - A Hash describing the availability details for the event:
|
758
|
-
# :participants - A hash stating who is required for the availability
|
759
|
-
# call
|
760
|
-
# :required_duration - A hash stating the length of time the event will
|
761
|
-
# last for
|
762
|
-
# :available_periods - A hash stating the available periods for the event
|
763
|
-
# target_calendars - An array of hashes stating into which calendars to insert the created
|
764
|
-
# event
|
765
757
|
#
|
766
|
-
#
|
758
|
+
# Example
|
767
759
|
#
|
768
|
-
# - OAuth example
|
769
760
|
# client.add_to_calendar(
|
770
761
|
# oauth: {
|
771
762
|
# scopes: 'read_events delete_events',
|
@@ -784,6 +775,85 @@ module Cronofy
|
|
784
775
|
# long: "0.1234"
|
785
776
|
# })
|
786
777
|
#
|
778
|
+
# See http://www.cronofy.com/developers/api#upsert-event for reference.
|
779
|
+
#
|
780
|
+
# Returns a AddToCalendarResponse.
|
781
|
+
#
|
782
|
+
# Raises Cronofy::CredentialsMissingError if no credentials available.
|
783
|
+
# Raises Cronofy::AuthenticationFailureError if the access token is no
|
784
|
+
# longer valid.
|
785
|
+
# Raises Cronofy::AuthorizationFailureError if the access token does not
|
786
|
+
# include the required scope.
|
787
|
+
# Raises Cronofy::NotFoundError if the calendar does not exist.
|
788
|
+
# Raises Cronofy::InvalidRequestError if the request contains invalid
|
789
|
+
# parameters.
|
790
|
+
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
791
|
+
# limits for the application.
|
792
|
+
def add_to_calendar(args = {})
|
793
|
+
body = args.merge(client_id: @client_id, client_secret: @client_secret)
|
794
|
+
|
795
|
+
body[:event][:start] = encode_event_time(body[:event][:start])
|
796
|
+
body[:event][:end] = encode_event_time(body[:event][:end])
|
797
|
+
|
798
|
+
response = post("/v1/add_to_calendar", body)
|
799
|
+
parse_json(AddToCalendarResponse, nil , response)
|
800
|
+
end
|
801
|
+
|
802
|
+
# Public: Generates an real time scheduling link to start the OAuth process with
|
803
|
+
# an event to be automatically upserted
|
804
|
+
#
|
805
|
+
# oauth - A Hash describing the OAuth flow required:
|
806
|
+
# :scope - A String representing the scopes to ask for
|
807
|
+
# within the OAuth flow
|
808
|
+
# :redirect_uri - A String containing a url to redirect the
|
809
|
+
# user to after completing the OAuth flow.
|
810
|
+
# :scope - A String representing additional state to
|
811
|
+
# be passed within the OAuth flow.
|
812
|
+
#
|
813
|
+
# event - A Hash describing the event with symbolized keys:
|
814
|
+
# :event_id - A String uniquely identifying the event for
|
815
|
+
# your application (note: this is NOT an ID
|
816
|
+
# generated by Cronofy).
|
817
|
+
# :summary - A String to use as the summary, sometimes
|
818
|
+
# referred to as the name or title, of the
|
819
|
+
# event.
|
820
|
+
# :description - A String to use as the description, sometimes
|
821
|
+
# referred to as the notes or body, of the
|
822
|
+
# event.
|
823
|
+
# :url - The URL associated with the event.
|
824
|
+
# :location - A Hash describing the location of the event
|
825
|
+
# with symbolized keys (optional):
|
826
|
+
# :description - A String describing the
|
827
|
+
# location.
|
828
|
+
# :lat - A String of the location's latitude.
|
829
|
+
# :long - A String of the location's longitude.
|
830
|
+
# :reminders - An Array of Hashes describing the desired
|
831
|
+
# reminders for the event. Reminders should be
|
832
|
+
# specified in priority order as, for example,
|
833
|
+
# when the underlying provider only supports a
|
834
|
+
# single reminder then the first reminder will
|
835
|
+
# be used.
|
836
|
+
# :minutes - An Integer specifying the number
|
837
|
+
# of minutes before the start of the
|
838
|
+
# event that the reminder should
|
839
|
+
# occur.
|
840
|
+
# :transparency - The transparency state for the event (optional).
|
841
|
+
# Accepted values are "transparent" and "opaque".
|
842
|
+
# :attendees - A Hash of :invite and :reject, each of which is
|
843
|
+
# an array of invitees to invite to or reject from
|
844
|
+
# the event. Invitees are represented by a hash of
|
845
|
+
# :email and :display_name (optional).
|
846
|
+
# availability - A Hash describing the availability details for the event:
|
847
|
+
# :participants - A hash stating who is required for the availability
|
848
|
+
# call
|
849
|
+
# :required_duration - A hash stating the length of time the event will
|
850
|
+
# last for
|
851
|
+
# :available_periods - A hash stating the available periods for the event
|
852
|
+
# target_calendars - An array of hashes stating into which calendars to insert the created
|
853
|
+
# event
|
854
|
+
#
|
855
|
+
# Examples
|
856
|
+
#
|
787
857
|
# - Availability example
|
788
858
|
# client.add_to_calendar(
|
789
859
|
# oauth: {
|
@@ -835,24 +905,38 @@ module Cronofy
|
|
835
905
|
# parameters.
|
836
906
|
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
837
907
|
# limits for the application.
|
838
|
-
def
|
908
|
+
def real_time_scheduling(args = {})
|
839
909
|
body = args.merge(client_id: @client_id, client_secret: @client_secret)
|
840
910
|
|
841
|
-
if availability =
|
911
|
+
if availability = args[:availability]
|
842
912
|
availability[:participants] = map_availability_participants(availability[:participants])
|
843
913
|
availability[:required_duration] = map_availability_required_duration(availability[:required_duration])
|
844
|
-
|
845
|
-
translate_available_periods(availability[:available_periods])
|
846
|
-
body[:availability] = availability
|
847
914
|
end
|
848
915
|
|
849
|
-
|
850
|
-
body[:
|
916
|
+
translate_available_periods(availability[:available_periods])
|
917
|
+
body[:availability] = availability
|
851
918
|
|
852
|
-
response = post("/v1/
|
919
|
+
response = post("/v1/real_time_scheduling", body)
|
853
920
|
parse_json(AddToCalendarResponse, nil , response)
|
854
921
|
end
|
855
922
|
|
923
|
+
# Public: Creates a link_token to allow explicitly linking of an account
|
924
|
+
#
|
925
|
+
# See https://www.cronofy.com/developers/api/alpha/#auth-explicit-linking for
|
926
|
+
# reference.
|
927
|
+
#
|
928
|
+
# Returns a link token
|
929
|
+
#
|
930
|
+
# Raises Cronofy::CredentialsMissingError if no credentials available.
|
931
|
+
# Raises Cronofy::AuthenticationFailureError if the access token is no
|
932
|
+
# longer valid.
|
933
|
+
# Raises Cronofy::TooManyRequestsError if the request exceeds the rate
|
934
|
+
# limits for the application.
|
935
|
+
def link_token
|
936
|
+
response = post("/v1/link_tokens", nil)
|
937
|
+
parse_json(String, 'link_token', response)
|
938
|
+
end
|
939
|
+
|
856
940
|
private
|
857
941
|
|
858
942
|
def translate_available_periods(periods)
|
data/lib/cronofy/version.rb
CHANGED
@@ -1128,6 +1128,28 @@ describe Cronofy::Client do
|
|
1128
1128
|
end
|
1129
1129
|
end
|
1130
1130
|
|
1131
|
+
describe '#link_token' do
|
1132
|
+
let(:request_url) { 'https://api.cronofy.com/v1/link_tokens' }
|
1133
|
+
let(:method) { :post }
|
1134
|
+
let(:request_body) { nil }
|
1135
|
+
|
1136
|
+
let(:correct_response_code) { 200 }
|
1137
|
+
let(:correct_response_body) do
|
1138
|
+
{
|
1139
|
+
"link_token" => "abcd1234"
|
1140
|
+
}
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
let(:correct_mapped_result) do
|
1144
|
+
"abcd1234"
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
subject { client.link_token }
|
1148
|
+
|
1149
|
+
it_behaves_like 'a Cronofy request'
|
1150
|
+
it_behaves_like 'a Cronofy request with mapped return value'
|
1151
|
+
end
|
1152
|
+
|
1131
1153
|
describe 'Availability' do
|
1132
1154
|
describe '#availability' do
|
1133
1155
|
let(:method) { :post }
|
@@ -1488,16 +1510,12 @@ describe Cronofy::Client do
|
|
1488
1510
|
|
1489
1511
|
end
|
1490
1512
|
|
1491
|
-
describe "
|
1492
|
-
let(:request_url) { "https://api.cronofy.com/v1/
|
1513
|
+
describe "Real time scheduling" do
|
1514
|
+
let(:request_url) { "https://api.cronofy.com/v1/real_time_scheduling" }
|
1493
1515
|
let(:url) { URI("https://example.com") }
|
1494
1516
|
let(:method) { :post }
|
1495
1517
|
let(:request_headers) { json_request_headers }
|
1496
1518
|
|
1497
|
-
let(:start_datetime) { Time.utc(2014, 8, 5, 15, 30, 0) }
|
1498
|
-
let(:end_datetime) { Time.utc(2014, 8, 5, 17, 0, 0) }
|
1499
|
-
let(:encoded_start_datetime) { "2014-08-05T15:30:00Z" }
|
1500
|
-
let(:encoded_end_datetime) { "2014-08-05T17:00:00Z" }
|
1501
1519
|
let(:location) { { :description => "Board room" } }
|
1502
1520
|
let(:transparency) { nil }
|
1503
1521
|
let(:client_id) { 'example_id' }
|
@@ -1623,7 +1641,7 @@ describe Cronofy::Client do
|
|
1623
1641
|
}
|
1624
1642
|
end
|
1625
1643
|
|
1626
|
-
subject { client.
|
1644
|
+
subject { client.real_time_scheduling(args) }
|
1627
1645
|
|
1628
1646
|
context 'when start/end are Times' do
|
1629
1647
|
it_behaves_like 'a Cronofy request'
|
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.22.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-
|
12
|
+
date: 2017-06-09 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.
|
152
|
+
rubygems_version: 2.6.12
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Cronofy - one API for all the calendars
|