cronofy 0.37.6 → 0.40.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
  SHA256:
3
- metadata.gz: f7a632c7e4036fef7e004f6310425d235fea56520b297b4a3a0c644fe57a0011
4
- data.tar.gz: 0fc429f25dc4ff14003629e81139047c36ccdf7ba2e06631c0b22d913e709bb2
3
+ metadata.gz: 0407eb888cfab38dd60d84ad456d367da62d5021947bc9d7ccc1d66e8da8e3df
4
+ data.tar.gz: 24b3171b4e992004138871f4f30f92e840b22a6ef76bab5c7ec4f59574794ac1
5
5
  SHA512:
6
- metadata.gz: 92488cee8fea969192bc9ef1aa624872201c4928087b385f5d10cac11720575191cfbc89db86016c31ba87bac8f57b6d7890ab8e3beb2925a8eafc87cb98b08f
7
- data.tar.gz: 7c0651b6b64c64e50ce356699b9ea3ba58928dee2ccdb3922ae4cbbd6a6b4fd572f36871e045567675d6166e93d55c86afee92a6fba4e01e370f980fbd385d77
6
+ metadata.gz: e3e3d97475b91569ff5247604a4cdfc0b975d6a9aa1199e20b2e86e85d3b5e3060bfe193d12fe694a27432f79dba2d417580a25e46de3129cf7bd83d8c621f9d
7
+ data.tar.gz: db4b9e733ae6acee75880ff0fe72e5e6d42713d9c725d8211552647d1c2ec421628b5211222d2f3070ecbce2e6bd0682c1b74dfd2186c6f9d40a7996e9a4dc18
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [0.40.0]
2
+
3
+ * Update version of [OAuth2](https://rubygems.org/gems/oauth2) required [#102]
4
+
5
+ ## [0.39.0]
6
+
7
+ * Add conferencing services authorization
8
+
9
+ ## [0.38.0]
10
+
11
+ * Add state parameter to Service Account authorizations [#104]
12
+
13
+ ## [0.37.7]
14
+
15
+ * Update Gem description
16
+
1
17
  ## [0.37.6]
2
18
 
3
19
  * Adds support for disabling and fetching the status of Real-Time Scheduling links [#100]
@@ -207,6 +223,10 @@
207
223
  [0.37.4]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.4
208
224
  [0.37.5]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.5
209
225
  [0.37.6]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.6
226
+ [0.37.7]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.7
227
+ [0.38.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/0.38.0
228
+ [0.39.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/0.39.0
229
+ [0.40.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.40.0
210
230
 
211
231
  [#13]: https://github.com/cronofy/cronofy-ruby/pull/13
212
232
  [#16]: https://github.com/cronofy/cronofy-ruby/pull/16
@@ -255,3 +275,6 @@
255
275
  [#97]: https://github.com/cronofy/cronofy-ruby/pull/97
256
276
  [#99]: https://github.com/cronofy/cronofy-ruby/pull/99
257
277
  [#100]: https://github.com/cronofy/cronofy-ruby/pull/100
278
+ [#102]: https://github.com/cronofy/cronofy-ruby/pull/102
279
+ [#104]: https://github.com/cronofy/cronofy-ruby/pull/104
280
+ [#108]: https://github.com/cronofy/cronofy-ruby/pull/108
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
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = Dir['spec/**/*.rb']
19
19
 
20
20
  spec.add_runtime_dependency "hashie", ">= 2.1", "< 5"
21
- spec.add_runtime_dependency "oauth2", "~> 1.0"
21
+ spec.add_runtime_dependency "oauth2", ">= 2.0.4"
22
22
 
23
23
  spec.add_development_dependency "bundler", ">= 1.6", "< 3"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
@@ -15,6 +15,7 @@ module Cronofy
15
15
  # @see Client#request
16
16
  def request(verb, path, opts = {}, &block)
17
17
  configure_authentication!(opts)
18
+ opts = { snaky: false }.merge(opts)
18
19
  do_request { @client.request(verb, path, opts, &block) }
19
20
  end
20
21
 
data/lib/cronofy/auth.rb CHANGED
@@ -16,8 +16,8 @@ module Cronofy
16
16
 
17
17
  @client_credentials_missing = blank?(client_id) || blank?(client_secret)
18
18
 
19
- @auth_client = OAuth2::Client.new(client_id, client_secret, site: ::Cronofy.app_url(data_center), connection_opts: { headers: { "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}" } })
20
- @api_client = OAuth2::Client.new(client_id, client_secret, site: ::Cronofy.api_url(data_center), connection_opts: { headers: { "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}" } })
19
+ @auth_client = OAuth2::Client.new(client_id, client_secret, site: ::Cronofy.app_url(data_center), auth_scheme: :request_body, connection_opts: { headers: { "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}" } })
20
+ @api_client = OAuth2::Client.new(client_id, client_secret, site: ::Cronofy.api_url(data_center), auth_scheme: :request_body, connection_opts: { headers: { "User-Agent" => "Cronofy Ruby #{::Cronofy::VERSION}" } })
21
21
 
22
22
  set_access_token(access_token, refresh_token) if access_token || refresh_token
23
23
  set_api_key(client_secret) if client_secret
@@ -312,6 +312,24 @@ module Cronofy
312
312
  nil
313
313
  end
314
314
 
315
+ # Public: Returns an URL where users can authorize access to their conferencing services.
316
+ #
317
+ # See https://docs.cronofy.com/developers/api/conferencing-services/authorization/ for reference.
318
+ #
319
+ # Returns Cronofy::ConferencingServiceAuthorizationResponse with the generated URL
320
+ #
321
+ # Raises Cronofy::BadRequestError if refresh token code is unknown or has
322
+ # been revoked.
323
+ # Raises Cronofy::AuthenticationFailureError if the client ID and secret are
324
+ # not valid.
325
+ # Raises Cronofy::CredentialsMissingError if no credentials available.
326
+ def get_conferencing_service_authorizations(redirect_uri)
327
+ data = { redirect_uri: redirect_uri }
328
+
329
+ response = post "/v1/conferencing_service_authorizations", data
330
+ parse_json(ConferencingServiceAuthorizationResponse, "authorization_request", response)
331
+ end
332
+
315
333
  class BatchBuilder
316
334
  include TimeEncoding
317
335
 
@@ -641,7 +659,7 @@ module Cronofy
641
659
  # longer valid.
642
660
  # Raises Cronofy::TooManyRequestsError if the request exceeds the rate
643
661
  # limits for the application.
644
- def authorize_with_service_account(email, scope, callback_url)
662
+ def authorize_with_service_account(email, scope, callback_url, state)
645
663
  if scope.respond_to?(:join)
646
664
  scope = scope.join(' ')
647
665
  end
@@ -649,7 +667,8 @@ module Cronofy
649
667
  params = {
650
668
  email: email,
651
669
  scope: scope,
652
- callback_url: callback_url
670
+ callback_url: callback_url,
671
+ state: state
653
672
  }
654
673
  post("/v1/service_account_authorizations", params)
655
674
  nil
data/lib/cronofy/types.rb CHANGED
@@ -417,4 +417,7 @@ module Cronofy
417
417
  class RealTimeSchedulingStatus < CronofyMash
418
418
  coerce_key :event, Event
419
419
  end
420
+
421
+ class ConferencingServiceAuthorizationResponse < CronofyMash
422
+ end
420
423
  end
@@ -1,3 +1,3 @@
1
1
  module Cronofy
2
- VERSION = "0.37.6".freeze
2
+ VERSION = "0.40.0".freeze
3
3
  end
@@ -658,14 +658,15 @@ describe Cronofy::Client do
658
658
  let(:request_url) { "https://api.cronofy.com/v1/service_account_authorizations" }
659
659
  let(:method) { :post }
660
660
  let(:request_headers) { json_request_headers }
661
- let(:request_body) { { email: email, scope: scope.join(' '), callback_url: callback_url } }
661
+ let(:request_body) { { email: email, scope: scope.join(' '), callback_url: callback_url, state: state } }
662
662
  let(:correct_response_code) { 202 }
663
663
  let(:correct_response_body) { nil }
664
664
  let(:email) { "foo@example.com" }
665
665
  let(:scope) { ['foo', 'bar'] }
666
- let(:callback_url) { "http://example.com/not_found" }
666
+ let(:callback_url) { "https://example.com/callback" }
667
+ let(:state) { 'state' }
667
668
 
668
- subject { client.authorize_with_service_account(email, scope, callback_url) }
669
+ subject { client.authorize_with_service_account(email, scope, callback_url, state) }
669
670
 
670
671
  it_behaves_like 'a Cronofy request'
671
672
  end
@@ -3709,4 +3710,31 @@ describe Cronofy::Client do
3709
3710
  it_behaves_like 'a Cronofy request'
3710
3711
  it_behaves_like 'a Cronofy request with mapped return value'
3711
3712
  end
3713
+
3714
+ describe 'Conferencing Services' do
3715
+ describe '#get_conferencing_service_authorizations' do
3716
+ let(:redirect_uri) { "http://example.com/not_found" }
3717
+ let(:request_url) { "https://api.cronofy.com/v1/conferencing_service_authorizations" }
3718
+ let(:method) { :post }
3719
+ let(:request_body) {
3720
+ { redirect_uri: redirect_uri }
3721
+ }
3722
+ let(:correct_response_code) { 200 }
3723
+ let(:correct_response_body) do
3724
+ {
3725
+ "authorization_request" => {
3726
+ "url": "https://app.cronofy.com/conferencing_services/foo"
3727
+ }
3728
+ }
3729
+ end
3730
+ let(:correct_mapped_result) do
3731
+ Cronofy::ConferencingServiceAuthorizationResponse.new(correct_response_body['authorization_request'])
3732
+ end
3733
+
3734
+ subject { client.get_conferencing_service_authorizations(redirect_uri) }
3735
+
3736
+ it_behaves_like 'a Cronofy request'
3737
+ it_behaves_like 'a Cronofy request with mapped return value'
3738
+ end
3739
+ end
3712
3740
  end
data/spec/spec_helper.rb CHANGED
@@ -2,3 +2,4 @@ require 'ostruct'
2
2
  require 'cronofy'
3
3
 
4
4
  require 'webmock/rspec'
5
+ require 'securerandom'
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.6
4
+ version: 0.40.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: 2022-04-05 00:00:00.000000000 Z
12
+ date: 2023-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -35,16 +35,16 @@ dependencies:
35
35
  name: oauth2
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: 2.0.4
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: 2.0.4
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bundler
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -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.3.8
159
+ rubygems_version: 3.1.4
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Cronofy - the scheduling platform for business