calendly 0.3.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 3656dc7886aad2a35932152a25f601d2160bed7f53b4ead91e67eb4cb82bb433
4
- data.tar.gz: 337d5637a69e30e1dcc943ac1332f38b1675e3d55e0c09049d9308661b4edbe3
3
+ metadata.gz: 707a9cda35428975745f73c6c9b714bda1ec4bfd769f3b21cd66cf53e45e5eee
4
+ data.tar.gz: 8d249367bc1d6ffe766adf653f624ca4d15cf7c8fa4a51cca1a2329f3cbfbdeb
5
5
  SHA512:
6
- metadata.gz: 32d0c18ebb375a99fb1b23b4365f99ba5957ebbbfed497690ef7d6db8bb0e0ada413853a927892963af62cc21afe39ad6f8d5740831af2e4e881fcc8e9bb5017
7
- data.tar.gz: 81a59436778d27892dd325496bc234bea9380fba303b872a2d04ba6ea4b18d73b94d3a13133f7b90f2a68f19a994263ef464a60332239df3f61e064a6d116841
6
+ metadata.gz: 7685bb924251ccdaa0b93e4b95e43bd4ede147d2029ca83f1b2af1eff9f21e13a64b7acb88c5f63e1e8cfd84bcec8ba61fadbc7f577eaeb52e144ffa50fb4243
7
+ data.tar.gz: e01999d2785ebbe123ab08e63689a509ddf595433efa35b621c1d4e6bcdc94dea0b6df3fc87e2260147036cc9a85a85023c8c24e3bc6c8cd186cda16afcec92b
@@ -1,12 +1,43 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.1
4
+
5
+ - added method EventType#fetch
6
+
7
+ ## 0.5.0
8
+
9
+ - changed Calendly::Client#scheduled_events behavior (refs #21)
10
+ - previous version:
11
+ - getting events belonging to a specific USER
12
+ - current version:
13
+ - getting all events belonging to a specific ORGANIZATION
14
+ - added Calendly::Client#scheduled_events_by_user method instead_of the before behavior
15
+
16
+ ## 0.4.2
17
+
18
+ - added new following fields to Invitee model (refs #21)
19
+ - :rescheduled
20
+ - :old_invitee
21
+ - :new_invitee
22
+ - :cancel_url
23
+ - :reschedule_url
24
+
25
+ ## 0.4.1
26
+
27
+ - started to support a API
28
+ - `GET /event_types/{uuid}`
29
+
30
+ ## 0.4.0
31
+
32
+ - fixed a changes for Location fields such as `kind` to `type`. (refs #18)
33
+
3
34
  ## 0.3.0
4
35
 
5
- - remove zeitwerk dependency. (refs #16)
36
+ - removed zeitwerk dependency. (refs #16)
6
37
 
7
38
  ## 0.2.0
8
39
 
9
- - save fetched data in cache. (refs #14)
40
+ - added caching features in object when fetching data. (refs #14)
10
41
 
11
42
  ## 0.1.3
12
43
 
@@ -18,59 +49,59 @@
18
49
 
19
50
  ## 0.1.2
20
51
 
21
- - fix rubocop warnings.
52
+ - fixed rubocop warnings.
22
53
 
23
54
  ## 0.1.1
24
55
 
25
- - add tests to make coverage 100%.
56
+ - added tests to make coverage 100%.
26
57
 
27
58
  ## 0.1.0
28
59
 
29
- - define methods to access associated resources with each model.
30
- - rename methods:
60
+ - defined methods to access associated resources with each model.
61
+ - renamed methods:
31
62
  - `Calendly::Client#events` to `Calendly::Client#scheduled_events`
32
63
 
33
64
  ## 0.0.7.alpha
34
65
 
35
- - support APIs
66
+ - started to support APIs
36
67
  - `POST /organizations/{uuid}/invitations`
37
68
  - `DELETE /organizations/{org_uuid}/invitations/{invitation_uuid}`
38
69
  - `DELETE /organization_memberships/{uuid}`
39
70
 
40
71
  ## 0.0.6.alpha
41
72
 
42
- - support APIs
73
+ - started to support APIs
43
74
  - `GET /organizations/{uuid}/invitations`
44
75
  - `GET /organizations/{organization_uuid}/invitations/{invitation_uuid}`
45
76
 
46
77
  ## 0.0.5.alpha
47
78
 
48
- - support APIs
79
+ - started to support APIs
49
80
  - `GET /organization_memberships`
50
81
  - `GET /organization_memberships/{uuid}`
51
- - rename fields
82
+ - renamed fields
52
83
  - Invitee#event to Invitee#event_uri
53
84
  - Event#event_type to Event#event_type_uri
54
85
 
55
86
  ## 0.0.4.alpha
56
87
 
57
- - support APIs
88
+ - started to support APIs
58
89
  - `GET /scheduled_events/{event_uuid}/invitees`
59
90
  - `GET /scheduled_events/{event_uuid}/invitees/{invitee_uuid}`
60
91
 
61
92
  ## 0.0.3.alpha
62
93
 
63
- - support APIs
94
+ - started to support APIs
64
95
  - `GET /scheduled_events`
65
96
  - `GET /scheduled_events/{uuid}`
66
97
 
67
98
  ## 0.0.2.alpha
68
99
 
69
- - support APIs
100
+ - started to support APIs
70
101
  - `GET /event_types`
71
102
 
72
103
  ## 0.0.1.alpha
73
104
 
74
105
  - Initial release
75
- - support APIs
106
+ - started to support a API
76
107
  - `GET /users/{uuid}`
@@ -88,6 +88,20 @@ module Calendly
88
88
  User.new body[:resource], self
89
89
  end
90
90
 
91
+ #
92
+ # Returns a single Event Type by its UUID.
93
+ #
94
+ # @param [String] uuid the specified event type (event type's uuid).
95
+ # @return [Calendly::EventType]
96
+ # @raise [Calendly::Error] if the uuid arg is empty.
97
+ # @raise [Calendly::ApiError] if the api returns error code.
98
+ # @since 0.4.1
99
+ def event_type(uuid)
100
+ check_not_empty uuid, 'uuid'
101
+ body = request :get, "event_types/#{uuid}"
102
+ EventType.new body[:resource], self
103
+ end
104
+
91
105
  #
92
106
  # Returns all Event Types associated with a specified User.
93
107
  #
@@ -130,10 +144,42 @@ module Calendly
130
144
  end
131
145
 
132
146
  #
133
- # Get List of User Events.
147
+ # Get List of scheduled events belonging to a specific organization.
148
+ #
149
+ # @param [String] org_uri the specified organization (organization's uri).
150
+ # @param [Hash] opts the optional request parameters.
151
+ # @option opts [Integer] :count Number of rows to return.
152
+ # @option opts [String] :invitee_email Return events scheduled with the specified invitee email.
153
+ # @option opts [String] :max_start_time Upper bound (inclusive) for an event's start time to filter by.
154
+ # @option opts [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
155
+ # @option opts [String] :page_token Pass this to get the next portion of collection.
156
+ # @option opts [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
157
+ # @option opts [String] :status Whether the scheduled event is active or canceled.
158
+ # @return [Array<Array<Calendly::Event>, Hash>]
159
+ # - [Array<Calendly::Event>] events
160
+ # - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
161
+ # @raise [Calendly::Error] if the org_uri arg is empty.
162
+ # @raise [Calendly::ApiError] if the api returns error code.
163
+ # @since 0.5.0
164
+ def scheduled_events(org_uri, opts = {})
165
+ check_not_empty org_uri, 'org_uri'
166
+
167
+ opts_keys = %i[count invitee_email max_start_time min_start_time page_token sort status]
168
+ params = {organization: org_uri}
169
+ params = merge_options opts, opts_keys, params
170
+ body = request :get, 'scheduled_events', params: params
171
+
172
+ items = body[:collection] || []
173
+ evs = items.map { |item| Event.new item, self }
174
+ [evs, next_page_params(body)]
175
+ end
176
+
177
+ #
178
+ # Get List of scheduled events belonging to a specific user.
134
179
  #
135
180
  # @param [String] user_uri the specified user (user's uri).
136
181
  # @param [Hash] opts the optional request parameters.
182
+ # @option opts [String] :organization the specified organization (organization's uri).
137
183
  # @option opts [Integer] :count Number of rows to return.
138
184
  # @option opts [String] :invitee_email Return events scheduled with the specified invitee email.
139
185
  # @option opts [String] :max_start_time Upper bound (inclusive) for an event's start time to filter by.
@@ -147,10 +193,10 @@ module Calendly
147
193
  # @raise [Calendly::Error] if the user_uri arg is empty.
148
194
  # @raise [Calendly::ApiError] if the api returns error code.
149
195
  # @since 0.0.3
150
- def scheduled_events(user_uri, opts = {})
196
+ def scheduled_events_by_user(user_uri, opts = {})
151
197
  check_not_empty user_uri, 'user_uri'
152
198
 
153
- opts_keys = %i[count invitee_email max_start_time min_start_time page_token sort status]
199
+ opts_keys = %i[organization count invitee_email max_start_time min_start_time page_token sort status]
154
200
  params = {user: user_uri}
155
201
  params = merge_options opts, opts_keys, params
156
202
  body = request :get, 'scheduled_events', params: params
@@ -221,7 +267,7 @@ module Calendly
221
267
  end
222
268
 
223
269
  #
224
- # Get List memberships of all users belonging to an organization.
270
+ # Get List of memberships belonging to specific an organization.
225
271
  #
226
272
  # @param [String] org_uri the specified organization (organization's uri).
227
273
  # @param [Hash] opts the optional request parameters.
@@ -248,7 +294,7 @@ module Calendly
248
294
  end
249
295
 
250
296
  #
251
- # Get List memberships of all users belonging to an organization by user.
297
+ # Get List of memberships belonging to specific a user.
252
298
  #
253
299
  # @param [String] user_uri the specified user (user's uri).
254
300
  # @param [Hash] opts the optional request parameters.
@@ -75,6 +75,17 @@ module Calendly
75
75
  # Whether the profile belongs to a “User” or a “Team”.
76
76
  attr_accessor :owner_type
77
77
 
78
+ #
79
+ # Get EventType associated with self.
80
+ #
81
+ # @return [Calendly::EventType]
82
+ # @raise [Calendly::Error] if the uuid is empty.
83
+ # @raise [Calendly::ApiError] if the api returns error code.
84
+ # @since 0.5.1
85
+ def fetch
86
+ client.event_type uuid
87
+ end
88
+
78
89
  private
79
90
 
80
91
  def after_set_attributes(attrs)
@@ -34,6 +34,22 @@ module Calendly
34
34
  # @return [String]
35
35
  # Text (SMS) reminder phone number.
36
36
  attr_accessor :text_reminder_number
37
+ # @return [Boolean]
38
+ # Indicates if this invitee has rescheduled.
39
+ # If true, a reference to the new Invitee instance is provided in the new_invitee field.
40
+ attr_accessor :rescheduled
41
+ # @return [String, nil]
42
+ # Reference to old Invitee instance that got rescheduled.
43
+ attr_accessor :old_invitee
44
+ # @return [String, nil]
45
+ # Link to new invitee, after reschedule.
46
+ attr_accessor :new_invitee
47
+ # @return [String]
48
+ # Link to cancelling the event for the invitee.
49
+ attr_accessor :cancel_url
50
+ # @return [String]
51
+ # Link to rescheduling the event for the invitee.
52
+ attr_accessor :reschedule_url
37
53
  # @return [Time]
38
54
  # Moment when user record was first created.
39
55
  attr_accessor :created_at
@@ -4,51 +4,67 @@ require 'calendly/models/model_utils'
4
4
 
5
5
  module Calendly
6
6
  # Calendly's location model.
7
- # Polymorphic base type for the various supported meeting locations.
7
+ # The polymorphic base type for an event location that Calendly supports
8
8
  class Location
9
9
  include ModelUtils
10
10
 
11
+ #
11
12
  # data patterns is below:
12
- # - 1. A meeting at a pre-specified physical location
13
- # - [String] :kind
14
- # - [String] :location A physical location specified by the meeting publisher.
15
- # - 2. Meeting publisher will call the invitee
16
- # - [String] :kind
17
- # - 3. Invitee will call meeting publisher at the specified phone number.
18
- # - [String] :kind
19
- # - [String] :phone_number Phone number invitee should use to reach meeting publisher.
20
- # - 4. Meeting will take place in a Google Meet / Hangout conference.
21
- # - [String] :kind
22
- # - 5. Meeting will take place in a Zoom conference.
23
- # - [String] :kind
24
- # - 6. Meeting will take place in a GotoMeeting conference.
25
- # - [String] :kind
26
- # - [String] :external_id Zoom-supplied conference id.
27
- # - [String] :state Current state of the conference in Zoom.
28
- # - [Hash] :data Arbitrary conference metadata supplied by Zoom.
29
- # - 7. Arbitrary conference metadata supplied by GotoMeeting.
30
- # - [String] :kind
31
- # - [String] :external_id GotoMeeting-supplied conference id.
32
- # - [String] :state Current state of the conference in GotoMeeting.
33
- # - [String] :data Arbitrary conference metadata supplied by GotoMeeting.
34
- # - 8. Meeting location does not fall in a standard category, and is as described by the meeting publisher.
35
- # - [String] :kind
36
- # - [String] :location Location description provided by meeting publisher.
37
- # - 9. Meeting location was specified by invitee.
38
- # - [String] :kind
39
- # - [String] :location Meeting location was specified by invitee.
13
+ #
14
+ # 1. In-Person Meeting: Information about the physical (in-person) event location.
15
+ # @param [String] type Indicates that the event host (publisher) will call the invitee.
16
+ # @param [String] location The physical location specified by the event host (publisher).
17
+ #
18
+ # 2. Outbound Call: Meeting publisher will call the Invitee
19
+ # @param [String] type Indicates that the event host (publisher) will call the invitee.
20
+ # @param [String] location The phone number the event host (publisher) will use to call the invitee.
21
+ #
22
+ # 3. Inbound Call: Invitee will call meeting publisher at the specified phone number.
23
+ # @param [String] type Indicates that the invitee will call the event host.
24
+ # @param [String] location The phone number the invitee will use to call the event host (publisher).
25
+ #
26
+ # 4. Google Conference: Details about an Event that will take place using a Google Meet / Hangout conference.
27
+ # @param [String] type The event location is a Google Meet or Hangouts conference.
28
+ # @param [String] status Indicates the current status of the Google conference.
29
+ # @param [String] join_url Google conference meeting url.
30
+ #
31
+ # 5. Zoom Conference: Meeting will take place in a Zoom conference.
32
+ # @param [String] type The event location is a Zoom conference
33
+ # @param [String] status Indicates the current status of the Zoom conference.
34
+ # @param [String] join_url Zoom meeting url.
35
+ # @param [Hash] data The conference metadata supplied by Zoom.
36
+ #
37
+ # 6. GoToMeeting Conference: Details about an Event that will take place using a GotoMeeting conference
38
+ # @param [String] type The event location is a GoToMeeting conference.
39
+ # @param [String] status Indicates the current status of the GoToMeeting conference.
40
+ # @param [String] join_url GoToMeeting conference meeting url.
41
+ # @param [Hash] data The conference metadata supplied by GoToMeeting.
42
+ #
43
+ # 7. Microsoft Teams Conference:
44
+ # @param [String] type The event location is a Zoom conference.
45
+ # @param [String] status Indicates the current status of the Microsoft Teams conference.
46
+ # @param [String] join_url Microsoft Teams meeting url.
47
+ # @param [Hash] data The conference metadata supplied by Microsoft Teams.
48
+ #
49
+ # 8. Custom Location:
50
+ # Use this to describe an existing Calendly-supported event location.
51
+ # @param [String] type The event location doesn't fall into a standard category defined by the event host (publisher).
52
+ # @param [String] location The event location description provided by the invitee.
53
+ #
54
+ # 9. Invitee Specified Location:
55
+ # Information about an event location that’s specified by the invitee.
56
+ # @param [String] type The event location selected by the invitee.
57
+ # @param [String] location The event location description provided by the invitee.
40
58
  #
41
59
 
42
60
  # @return [String]
43
- attr_accessor :kind
61
+ attr_accessor :type
44
62
  # @return [String]
45
63
  attr_accessor :location
46
64
  # @return [String]
47
- attr_accessor :phone_number
48
- # @return [String]
49
- attr_accessor :external_id
65
+ attr_accessor :status
50
66
  # @return [String]
51
- attr_accessor :state
67
+ attr_accessor :join_url
52
68
  # @return [Hash]
53
69
  attr_accessor :data
54
70
  end
@@ -80,6 +80,35 @@ module Calendly
80
80
  client.create_invitation uuid, email
81
81
  end
82
82
 
83
+ #
84
+ # Returns all Scheduled Events associated with self.
85
+ #
86
+ # @param [Hash] opts the optional request parameters.
87
+ # @option opts [Integer] :count Number of rows to return.
88
+ # @option opts [String] :invitee_email Return events scheduled with the specified invitee email
89
+ # @option opts [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by.
90
+ # @option opts [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
91
+ # @option opts [String] :page_token Pass this to get the next portion of collection.
92
+ # @option opts [String] :sort Order results by the specified field and directin.
93
+ # Accepts comma-separated list of {field}:{direction} values.
94
+ # @option opts [String] :status Whether the scheduled event is active or canceled
95
+ # @return [Array<Calendly::Event>]
96
+ # @raise [Calendly::Error] if the uri is empty.
97
+ # @raise [Calendly::ApiError] if the api returns error code.
98
+ # @since 0.5.0
99
+ def scheduled_events(opts = {})
100
+ return @cached_scheduled_events if @cached_scheduled_events
101
+
102
+ request_proc = proc { |options| client.scheduled_events uri, options }
103
+ @cached_scheduled_events = auto_pagination request_proc, opts
104
+ end
105
+
106
+ # @since 0.5.0
107
+ def scheduled_events!(opts = {})
108
+ @cached_scheduled_events = nil
109
+ scheduled_events opts
110
+ end
111
+
83
112
  #
84
113
  # Get List of organization scope Webhooks associated with self.
85
114
  #
@@ -116,7 +116,7 @@ module Calendly
116
116
  def scheduled_events(opts = {})
117
117
  return @cached_scheduled_events if @cached_scheduled_events
118
118
 
119
- request_proc = proc { |options| client.scheduled_events uri, options }
119
+ request_proc = proc { |options| client.scheduled_events_by_user uri, options }
120
120
  @cached_scheduled_events = auto_pagination request_proc, opts
121
121
  end
122
122
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Calendly
4
- VERSION = '0.3.0'
4
+ VERSION = '0.5.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -154,7 +154,7 @@ metadata:
154
154
  homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
155
155
  source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
156
156
  changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
157
- documentation_uri: https://www.rubydoc.info/gems/calendly/0.3.0
157
+ documentation_uri: https://www.rubydoc.info/gems/calendly/0.5.1
158
158
  post_install_message:
159
159
  rdoc_options: []
160
160
  require_paths: