calendlyr 0.7.3 → 0.7.5

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: c57c6eee34f296883a41d1c78d7f9ab9f142768353c78068a91ed7a4f6ec33f8
4
- data.tar.gz: b1adb963d1d9ec9b2529d2765b7ddc6c0ea2a92fb5a89b016154abbacdb0d7dd
3
+ metadata.gz: d69cdfb2373e6ecbed4936f15670331a83b20816bd77e9aec6c166e43d47cde3
4
+ data.tar.gz: ebe3df79b6d23e1e6539d63c0bf447396aa80037304f765b04414cf4e862a745
5
5
  SHA512:
6
- metadata.gz: db6766c86112dc3e944e3b6387bcd8e67b4c335804590d8cb7ef55081a874e0c572a647e9d9ce799ef1207434eeda482c6ca2ea12ba842ed20abe054d0e7ed67
7
- data.tar.gz: 4b59f6ad76dd238775a010501c647c383a0dca86861b1dc417b460d5f899b6b5be2852a6d1102a20637739857d7277eca3cf88655c7a1350fe08d1cb91cee894
6
+ metadata.gz: a3c733ada27c62a49fd5f2644ae2d0e6861c4c5e50b287b0e4173d7873a5e7f2cb83c37c3cde5509551bdea6c13b2d1c6469922c5a632076423c6f5aa8d26199
7
+ data.tar.gz: b6554a78bffea8609e5871f1c16e617997bcba34e2c348b285e1b5d27140a22009d91674dece47e37513fe6e7155c035654a49abd7713e211c0a64881e29b44c
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby: ["2.5", "2.6", "2.7", "3.0", "3.2"]
14
+ ruby: ["2.7", "3.0", "3.2", "3.3"]
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v4
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.7.5]
6
+ * Fix: Calendlyr::TooManyRequests was not included in autoloading list
7
+ * Fix: Calendlyr::ExternalCalendarError typo in class name
8
+
9
+ [0.7.5]: https://github.com/araluce/calendlyr/compare/v0.7.4...v0.7.5
10
+
11
+ ## [0.7.4]
12
+ * Fix: Error class name typo `ExternalCalendarEror` -> `ExternalCalendarError`
13
+ * Fix: Error class name typo `TooManyRequestsEror` -> `TooManyRequests`
14
+ * Updating rubies versions in CI to add 3.3
15
+ * Adding total rubygems downloads badge to README
16
+
17
+ [0.7.4]: https://github.com/araluce/calendlyr/compare/v0.7.3...v0.7.4
18
+
5
19
  ## [0.7.3]
6
20
  * Fix: Prevent possible empty body response to fail
7
21
 
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  [![](https://img.shields.io/github/license/araluce/calendlyr?kill_cache=1)](https://github.com/araluce/calendlyr/blob/master/LICENSE.txt)
2
2
  [![](https://github.com/araluce/calendlyr/actions/workflows/ci.yml/badge.svg?kill_cache=1)](https://github.com/araluce/calendlyr/actions)
3
3
  [![codecov](https://codecov.io/gh/araluce/calendlyr/branch/master/graph/badge.svg?token=YSUU4PHM6Y&kill_cache=1)](https://codecov.io/gh/araluce/calendlyr)
4
- [![Gem Version](https://badge.fury.io/rb/calendlyr.svg?kill_cache=1)](https://badge.fury.io/rb/calendlyr)
5
- ![Gem Downloads (for specified version)](https://img.shields.io/gem/dv/calendlyr/0.7.3?kill_cache=1)
4
+ ![Gem Downloads (for specified version)](https://img.shields.io/gem/dt/calendlyr)
6
5
 
7
6
  # Calendly API Rubygem
8
7
 
@@ -23,7 +22,7 @@ We understand the importance of not adding unwanted dependencies.
23
22
  Add this line to your application's Gemfile:
24
23
 
25
24
  ```ruby
26
- gem 'calendlyr', '0.7.3'
25
+ gem 'calendlyr', '0.7.5'
27
26
  ```
28
27
 
29
28
  And then execute:
data/calendlyr.gemspec CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_development_dependency "rake", "~> 12.0"
21
- spec.add_development_dependency "minitest", "~> 5.0"
22
- spec.add_development_dependency "standard"
23
- spec.add_development_dependency "webmock", "~> 3.14.0"
24
- spec.add_development_dependency "codecov"
25
- spec.add_development_dependency "simplecov"
20
+ spec.add_development_dependency "rake", "~> 13.2"
21
+ spec.add_development_dependency "minitest", "~> 5.25"
22
+ spec.add_development_dependency "standard", "~> 1.37" # Max version that supports Ruby 2.7
23
+ spec.add_development_dependency "webmock", "~> 3.23"
24
+ spec.add_development_dependency "codecov", "~> 0.6"
25
+ spec.add_development_dependency "simplecov", "~> 0.21"
26
26
  end
@@ -8,10 +8,6 @@ module Calendlyr
8
8
  @token = token
9
9
  end
10
10
 
11
- def availability
12
- AvailabilityResource.new(self)
13
- end
14
-
15
11
  def me(force_reload: false)
16
12
  @me = nil if force_reload
17
13
  @me ||= users.me
@@ -21,48 +17,23 @@ module Calendlyr
21
17
  me.organization
22
18
  end
23
19
 
24
- def users
25
- UserResource.new(self)
26
- end
27
-
28
- def organizations
29
- OrganizationResource.new(self)
30
- end
31
-
32
- def event_types
33
- EventTypeResource.new(self)
34
- end
35
-
36
- def events
37
- EventResource.new(self)
38
- end
39
-
40
- def groups
41
- GroupResource.new(self)
20
+ # Given a client.users, method_missing behaves like this:
21
+ # def users
22
+ # UsersResource.new(self)
23
+ # end
24
+ def method_missing(method_name, *args, &block)
25
+ resource_name = method_name.to_s.split("_").collect(&:capitalize).join + "Resource"
26
+ if Calendlyr.const_defined?(resource_name)
27
+ Calendlyr.const_get(resource_name).new(self)
28
+ else
29
+ super
30
+ end
42
31
  end
43
32
 
44
- def outgoing_communications
45
- OutgoingCommunicationResource.new(self)
46
- end
47
-
48
- def routing_forms
49
- RoutingFormResource.new(self)
50
- end
51
-
52
- def scheduling_links
53
- SchedulingLinkResource.new(self)
54
- end
55
-
56
- def shares
57
- ShareResource.new(self)
58
- end
59
-
60
- def webhooks
61
- WebhookResource.new(self)
62
- end
33
+ def respond_to_missing?(method_name, include_private = false)
34
+ resource_name = method_name.to_s.split("_").collect(&:capitalize).join + "Resource"
63
35
 
64
- def data_compliance
65
- DataComplianceResource.new(self)
36
+ Calendlyr.const_defined?(resource_name) || super
66
37
  end
67
38
 
68
39
  # Avoid returning #<Calendlyr::Client @token="token" ...>
@@ -11,11 +11,11 @@ module Calendlyr
11
11
 
12
12
  class NotFound < StandardError; end
13
13
 
14
- class ExternalCalendarEror < StandardError; end
14
+ class ExternalCalendarError < StandardError; end
15
15
 
16
16
  class InternalServerError < StandardError; end
17
17
 
18
- class TooManyRequestsEror < StandardError; end
18
+ class TooManyRequests < StandardError; end
19
19
 
20
20
  class ResponseErrorHandler
21
21
  ERROR_TYPES = {
@@ -23,8 +23,8 @@ module Calendlyr
23
23
  "401" => Unauthenticated,
24
24
  "403" => PermissionDenied,
25
25
  "404" => NotFound,
26
- "424" => ExternalCalendarEror,
27
- "429" => TooManyRequestsEror,
26
+ "424" => ExternalCalendarError,
27
+ "429" => TooManyRequests,
28
28
  "500" => InternalServerError
29
29
  }
30
30
 
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class EventTypeResource < Resource
2
+ class EventTypesResource < Resource
3
3
  def list(**params)
4
4
  response = get_request("event_types", params: params)
5
5
  Collection.from_response(response, type: EventType, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class EventResource < Resource
2
+ class EventsResource < Resource
3
3
  def list(**params)
4
4
  response = get_request("scheduled_events", params: params)
5
5
  Collection.from_response(response, type: Event, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class GroupResource < Resource
2
+ class GroupsResource < Resource
3
3
  def list(organization:, **params)
4
4
  response = get_request("groups", params: params.merge(organization: organization))
5
5
  Collection.from_response(response, type: Group, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class OrganizationResource < Resource
2
+ class OrganizationsResource < Resource
3
3
  def activity_log(organization: nil, **params)
4
4
  response = get_request("activity_log_entries", params: {organization: organization}.merge(params).compact)
5
5
  Collection.from_response(response, type: ActivityLog, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class OutgoingCommunicationResource < Resource
2
+ class OutgoingCommunicationsResource < Resource
3
3
  def list(**params)
4
4
  response = get_request("outgoing_communications", params: params)
5
5
  Collection.from_response(response, type: Object, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class RoutingFormResource < Resource
2
+ class RoutingFormsResource < Resource
3
3
  def list(organization:, **params)
4
4
  response = get_request("routing_forms", params: {organization: organization}.merge(params))
5
5
  Collection.from_response(response, type: RoutingForm, client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class SchedulingLinkResource < Resource
2
+ class SchedulingLinksResource < Resource
3
3
  def create(owner:, max_event_count:, owner_type: "EventType")
4
4
  body = {owner: owner, max_event_count: max_event_count, owner_type: owner_type}
5
5
  SchedulingLink.new post_request("scheduling_links", body: body).dig("resource").merge(client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class ShareResource < Resource
2
+ class SharesResource < Resource
3
3
  def create(event_type:, **params)
4
4
  body = {event_type: event_type}.merge(params)
5
5
  Share.new post_request("shares", body: body).dig("resource").merge(client: client)
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class UserResource < Resource
2
+ class UsersResource < Resource
3
3
  def me
4
4
  retrieve(uuid: "me")
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Calendlyr
2
- class WebhookResource < Resource
2
+ class WebhooksResource < Resource
3
3
  def list(organization:, scope:, **params)
4
4
  response = get_request("webhook_subscriptions", params: params.merge(organization: organization, scope: scope).compact)
5
5
  Collection.from_response(response, type: Webhooks::Subscription, client: client)
@@ -1,3 +1,3 @@
1
1
  module Calendlyr
2
- VERSION = "0.7.3"
2
+ VERSION = "0.7.5"
3
3
  end
data/lib/calendlyr.rb CHANGED
@@ -9,27 +9,28 @@ module Calendlyr
9
9
  # Errors
10
10
  autoload :BadRequest, "calendlyr/error"
11
11
  autoload :Error, "calendlyr/error"
12
- autoload :ExternalCalendarEror, "calendlyr/error"
12
+ autoload :ExternalCalendarError, "calendlyr/error"
13
13
  autoload :InternalServerError, "calendlyr/error"
14
14
  autoload :NotFound, "calendlyr/error"
15
15
  autoload :PaymentRequired, "calendlyr/error"
16
16
  autoload :PermissionDenied, "calendlyr/error"
17
- autoload :ResponseErrorHandler, "calendlyr/error"
18
17
  autoload :Unauthenticated, "calendlyr/error"
18
+ autoload :TooManyRequests, "calendlyr/error"
19
+ autoload :ResponseErrorHandler, "calendlyr/error"
19
20
 
20
21
  # High-level categories of Calendly API calls
21
22
  autoload :AvailabilityResource, "calendlyr/resources/availability"
22
23
  autoload :DataComplianceResource, "calendlyr/resources/data_compliance"
23
- autoload :EventResource, "calendlyr/resources/event"
24
- autoload :EventTypeResource, "calendlyr/resources/event_type"
25
- autoload :GroupResource, "calendlyr/resources/group"
26
- autoload :OrganizationResource, "calendlyr/resources/organization"
27
- autoload :OutgoingCommunicationResource, "calendlyr/resources/outgoing_communication"
28
- autoload :RoutingFormResource, "calendlyr/resources/routing_form"
29
- autoload :SchedulingLinkResource, "calendlyr/resources/scheduling_link"
30
- autoload :ShareResource, "calendlyr/resources/share"
31
- autoload :UserResource, "calendlyr/resources/user"
32
- autoload :WebhookResource, "calendlyr/resources/webhook"
24
+ autoload :EventsResource, "calendlyr/resources/events"
25
+ autoload :EventTypesResource, "calendlyr/resources/event_types"
26
+ autoload :GroupsResource, "calendlyr/resources/groups"
27
+ autoload :OrganizationsResource, "calendlyr/resources/organizations"
28
+ autoload :OutgoingCommunicationsResource, "calendlyr/resources/outgoing_communications"
29
+ autoload :RoutingFormsResource, "calendlyr/resources/routing_forms"
30
+ autoload :SchedulingLinksResource, "calendlyr/resources/scheduling_links"
31
+ autoload :SharesResource, "calendlyr/resources/shares"
32
+ autoload :UsersResource, "calendlyr/resources/users"
33
+ autoload :WebhooksResource, "calendlyr/resources/webhooks"
33
34
 
34
35
  # Classes used to return a nicer object wrapping the response data
35
36
  autoload :ActivityLog, "calendlyr/objects/activity_log"
@@ -8,4 +8,15 @@ class ClientTest < Minitest::Test
8
8
  def test_inspect
9
9
  assert_equal "#<Calendlyr::Client>", client.inspect
10
10
  end
11
+
12
+ def test_method_missing
13
+ assert_raises NoMethodError do
14
+ client.useers
15
+ end
16
+ end
17
+
18
+ def test_respond_to_missing?
19
+ assert client.respond_to?(:users)
20
+ refute client.respond_to?(:useers)
21
+ end
11
22
  end
@@ -20,4 +20,12 @@ class ResourceTest < Minitest::Test
20
20
  client.me
21
21
  end
22
22
  end
23
+
24
+ def test_handle_response_too_many_requests
25
+ stub(path: "users/me", response: {body: "", status: 429})
26
+
27
+ assert_raises Calendlyr::TooManyRequests do
28
+ client.me
29
+ end
30
+ end
23
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendlyr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - araluce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,84 +16,84 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '12.0'
19
+ version: '13.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '12.0'
26
+ version: '13.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '5.25'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: '5.25'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: standard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '1.37'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.37'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.14.0
61
+ version: '3.23'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.14.0
68
+ version: '3.23'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: codecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.6'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.6'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '0.21'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '0.21'
97
97
  description: 'Ruby bindings for Calendly API. Calendly APIs can be found here: https://calendly.stoplight.io/docs/api-docs/'
98
98
  email:
99
99
  - araluce11@gmail.com
@@ -177,16 +177,16 @@ files:
177
177
  - lib/calendlyr/resource.rb
178
178
  - lib/calendlyr/resources/availability.rb
179
179
  - lib/calendlyr/resources/data_compliance.rb
180
- - lib/calendlyr/resources/event.rb
181
- - lib/calendlyr/resources/event_type.rb
182
- - lib/calendlyr/resources/group.rb
183
- - lib/calendlyr/resources/organization.rb
184
- - lib/calendlyr/resources/outgoing_communication.rb
185
- - lib/calendlyr/resources/routing_form.rb
186
- - lib/calendlyr/resources/scheduling_link.rb
187
- - lib/calendlyr/resources/share.rb
188
- - lib/calendlyr/resources/user.rb
189
- - lib/calendlyr/resources/webhook.rb
180
+ - lib/calendlyr/resources/event_types.rb
181
+ - lib/calendlyr/resources/events.rb
182
+ - lib/calendlyr/resources/groups.rb
183
+ - lib/calendlyr/resources/organizations.rb
184
+ - lib/calendlyr/resources/outgoing_communications.rb
185
+ - lib/calendlyr/resources/routing_forms.rb
186
+ - lib/calendlyr/resources/scheduling_links.rb
187
+ - lib/calendlyr/resources/shares.rb
188
+ - lib/calendlyr/resources/users.rb
189
+ - lib/calendlyr/resources/webhooks.rb
190
190
  - lib/calendlyr/version.rb
191
191
  - test/calendlyr/client_test.rb
192
192
  - test/calendlyr/object_test.rb