calendly 0.11.1 → 0.12.0

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: 5ce5444bfb8db3d61a37abcbe3c42ce2cf517b00c00f865148e00bc543011d7a
4
- data.tar.gz: 3f6ed1de7cd5c2bbbb28047ba54a143e37ce44e4455326eb9981e52c575c86fc
3
+ metadata.gz: 7e93c2dc16d8ea8b5c14d890394dbaf898935d1ac3bfa85d091056be51fc5e30
4
+ data.tar.gz: 49b3c47b087a73d2fb86e00e301daa7661bf0b5d0bf3014142806dd64006f9a5
5
5
  SHA512:
6
- metadata.gz: fe02a87e62592413d76fcf5d25a8bb49acc01b232a7454b631a03a42fd4cd0ceedbf289542bc72c7ffafbd11dad101fe2b31d6b6d3156e2e075d1ecb55a46e5c
7
- data.tar.gz: a084d2938851edebb77e55b5c4db0305eceac26cb1ed1f92c8e7b5b4a79791976a4e56f00267e3035f46c59a71a58614eab994235f1e1887cb3b4c58168cdce6
6
+ metadata.gz: 5e1d557c0df74d1ab77237bbea0199c0771576d780fac4e91147ee06cdbf7d215536220ff643b3167f026437c04ba650368f810cc3d554425c05eeb817b71d9e
7
+ data.tar.gz: 69d38a1904609257682374b562d3c45fc3cba63fdfab4654c83fa1739c1bb14bbbfb308a8b9a2a3aa1fdda69263a8fde3cc12e0d857d518e5ef0587c2963a7d0
data/CHANGELOG.md CHANGED
@@ -1,15 +1,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.12.0 - 2022-07-16
4
+
5
+ - supported Routing Form APIs. (#55)
6
+ - `GET /routing_forms`
7
+ - `GET /routing_forms/{uuid}`
8
+ - `GET /routing_form_submissions`
9
+ - `GET /routing_form_submissions/{uuid}`
10
+ - changed were followings:
11
+ - Client
12
+ - (Add method) routing_form
13
+ - (Add method) routing_forms
14
+ - (Add method) routing_form_submission
15
+ - (Add method) routing_form_submissions
16
+ - Organization model
17
+ - (Add method) routing_forms
18
+ - (Add method) routing_forms!
19
+ - Invitee model
20
+ - (Add field) routing_form_submission
21
+
3
22
  ## 0.11.1 - 2022-06-29
4
23
 
5
24
  - specified dependencies:
6
- - oauth2: 1.x series (refs #53)
7
- - faraday: 1.x or 2.x seriese (refs #51)
25
+ - oauth2: 1.x series (#53)
26
+ - faraday: 1.x or 2.x seriese (#50)
8
27
 
9
28
  ## 0.11.0 - 2022-05-02
10
29
 
11
30
  - supported a API `POST /scheduled_events/{uuid}/cancellation`. (#48)
12
- - changed files:
31
+ - changed were followings:
13
32
  - Client
14
33
  - (Add method) cancel_event
15
34
  - Event
@@ -19,7 +38,7 @@
19
38
  ## 0.10.0 - 2022-04-15
20
39
 
21
40
  - supported a API `POST /data_compliance/deletion/invitees`. (#28)
22
- - changed files:
41
+ - changed were followings:
23
42
  - Client
24
43
  - (Add method) delete_invitee_data
25
44
 
@@ -29,7 +48,7 @@
29
48
  - `GET /invitee_no_shows/{no_show_uuid}`
30
49
  - `POST /invitee_no_shows`
31
50
  - `DELETE /invitee_no_shows/{no_show_uuid}`
32
- - changed files:
51
+ - changed were followings:
33
52
  - Client
34
53
  - (Add method) invitee_no_show
35
54
  - (Add method) create_invitee_no_show
@@ -56,7 +75,7 @@
56
75
  ## 0.8.0 - 2021-06-03
57
76
 
58
77
  - used keyword arguments for optional parameters, to be friendly for programmer.
59
- - changed methods are followings:
78
+ - changed methods were followings:
60
79
  - Client
61
80
  - event_types
62
81
  - event_types_by_user
data/README.md CHANGED
@@ -104,14 +104,15 @@ invitation.delete
104
104
  The webhook usage is below.
105
105
 
106
106
  ```ruby
107
- events = ['invitee.created', 'invitee.canceled']
108
107
  url = 'https://example.com/received_event'
108
+ subscribable_user_events = ['invitee.created', 'invitee.canceled']
109
+ subscribable_org_events = ['invitee.created', 'invitee.canceled', 'routing_form_submission.created']
109
110
 
110
111
  #
111
112
  # create a user scope webhook
112
113
  #
113
114
  me = client.me
114
- user_webhook = me.create_webhook(url, events)
115
+ user_webhook = me.create_webhook(url, subscribable_user_events)
115
116
  # => #<Calendly::WebhookSubscription uuid="USER_WEBHOOK_001", state="active", scope="user", events=["invitee.created", "invitee.canceled"], callback_url="https://example.com/received_event", ..>
116
117
 
117
118
  # list of user scope webhooks
@@ -126,8 +127,8 @@ user_webhook.delete
126
127
  # create an organization scope webhook
127
128
  #
128
129
  org = client.me.current_organization
129
- org_webhook = org.create_webhook(url, events)
130
- # => #<Calendly::WebhookSubscription uuid="ORG_WEBHOOK_001", state="active", scope="organization", events=["invitee.created", "invitee.canceled"], callback_url="https://example.com/received_event", ..>
130
+ org_webhook = org.create_webhook(url, subscribable_org_events)
131
+ # => #<Calendly::WebhookSubscription uuid="ORG_WEBHOOK_001", state="active", scope="organization", events=["invitee.created", "invitee.canceled", "routing_form_submission.created"], callback_url="https://example.com/received_event", ..>
131
132
 
132
133
  # list of organization scope webhooks
133
134
  org.webhooks
data/calendly.gemspec CHANGED
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.4'
32
31
  spec.add_runtime_dependency 'faraday', '>= 1.0.0', '< 3.0.0'
32
+ spec.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.4'
33
33
 
34
34
  spec.add_development_dependency 'bundler'
35
35
  spec.add_development_dependency 'codecov'
@@ -113,7 +113,7 @@ module Calendly
113
113
  # @option options [String] :page_token Pass this to get the next portion of collection.
114
114
  # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
115
115
  # @return [Array<Array<Calendly::EventType>, Hash>]
116
- # - [Array<Calendly::EventType>] event_types
116
+ # - [Array<Calendly::EventType>] event types
117
117
  # - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
118
118
  # @raise [Calendly::Error] if the org_uri arg is empty.
119
119
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -141,7 +141,7 @@ module Calendly
141
141
  # @option options [String] :page_token Pass this to get the next portion of collection.
142
142
  # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
143
143
  # @return [Array<Array<Calendly::EventType>, Hash>]
144
- # - [Array<Calendly::EventType>] event_types
144
+ # - [Array<Calendly::EventType>] event types
145
145
  # - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
146
146
  # @raise [Calendly::Error] if the user_uri arg is empty.
147
147
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -210,7 +210,7 @@ module Calendly
210
210
  # @param [String] uuid the event's unique indentifier.
211
211
  # @param [Hash] options the optional request parameters. Optional.
212
212
  # @option options [String] :reason reason for cancellation.
213
- # @return [InviteeCancellation]
213
+ # @return [Calendly::InviteeCancellation]
214
214
  # @raise [Calendly::Error] if the uuid arg is empty.
215
215
  # @raise [Calendly::ApiError] if the api returns error code.
216
216
  # @since 0.11.0
@@ -609,7 +609,7 @@ module Calendly
609
609
  # Create a webhook subscription for an organization or user.
610
610
  #
611
611
  # @param [String] url Canonical reference (unique identifier) for the resource.
612
- # @param [Array<String>] events List of user events to subscribe to. options: invitee.created or invitee.canceled
612
+ # @param [Array<String>] events List of user events to subscribe to. options: invitee.created or invitee.canceled or routing_form_submission.created
613
613
  # @param [String] org_uri The unique reference to the organization that the webhook will be tied to.
614
614
  # @param [String] user_uri The unique reference to the user that the webhook will be tied to. Optional.
615
615
  # @param [String] signing_key secret key shared between your application and Calendly. Optional.
@@ -651,6 +651,88 @@ module Calendly
651
651
  true
652
652
  end
653
653
 
654
+ #
655
+ # Get a specified Routing Form.
656
+ #
657
+ # @param [String] uuid the specified routing form (routing form's uuid).
658
+ # @return [Calendly::RoutingForm]
659
+ # @raise [Calendly::Error] if the uuid arg is empty.
660
+ # @raise [Calendly::ApiError] if the api returns error code.
661
+ # @since 0.12.0
662
+ def routing_form(uuid)
663
+ check_not_empty uuid, 'uuid'
664
+ body = request :get, "routing_forms/#{uuid}"
665
+ RoutingForm.new body[:resource], self
666
+ end
667
+
668
+ #
669
+ # Get a list of Routing Forms for a specified Organization.
670
+ #
671
+ # @param [String] org_uri the specified organization (organization's uri).
672
+ # @param [Hash] options the optional request parameters. Optional.
673
+ # @option options [Integer] :count Number of rows to return.
674
+ # @option options [String] :page_token Pass this to get the next portion of collection.
675
+ # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
676
+ # @return [Array<Array<Calendly::RoutingForm>, Hash>]
677
+ # - [Array<Calendly::RoutingForm>] routing forms
678
+ # - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
679
+ # @raise [Calendly::Error] if the org_uri arg is empty.
680
+ # @raise [Calendly::ApiError] if the api returns error code.
681
+ # @since 0.12.0
682
+ def routing_forms(org_uri, options: nil)
683
+ check_not_empty org_uri, 'org_uri'
684
+
685
+ opts_keys = %i[count page_token sort]
686
+ params = {organization: org_uri}
687
+ params = merge_options options, opts_keys, params
688
+ body = request :get, 'routing_forms', params: params
689
+
690
+ items = body[:collection] || []
691
+ forms = items.map { |item| RoutingForm.new item, self }
692
+ [forms, next_page_params(body)]
693
+ end
694
+
695
+ #
696
+ # Get a specified Routing Form Submission.
697
+ #
698
+ # @param [String] uuid the specified routing form submission (routing form submission's uuid).
699
+ # @return [Calendly::RoutingFormSubmission]
700
+ # @raise [Calendly::Error] if the uuid arg is empty.
701
+ # @raise [Calendly::ApiError] if the api returns error code.
702
+ # @since 0.12.0
703
+ def routing_form_submission(uuid)
704
+ check_not_empty uuid, 'uuid'
705
+ body = request :get, "routing_form_submissions/#{uuid}"
706
+ RoutingFormSubmission.new body[:resource], self
707
+ end
708
+
709
+ #
710
+ # Get a list of Routing Form Submissions for a specified Routing Form.
711
+ #
712
+ # @param [String] form_uri the specified organization (routing form's uri).
713
+ # @param [Hash] options the optional request parameters. Optional.
714
+ # @option options [Integer] :count Number of rows to return.
715
+ # @option options [String] :page_token Pass this to get the next portion of collection.
716
+ # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
717
+ # @return [Array<Array<Calendly::RoutingFormSubmission>, Hash>]
718
+ # - [Array<Calendly::RoutingFormSubmission>] routing form submissions
719
+ # - [Hash] next_params the parameters to get next data. if thre is no next it returns nil.
720
+ # @raise [Calendly::Error] if the form_uri arg is empty.
721
+ # @raise [Calendly::ApiError] if the api returns error code.
722
+ # @since 0.12.0
723
+ def routing_form_submissions(form_uri, options: nil)
724
+ check_not_empty form_uri, 'form_uri'
725
+
726
+ opts_keys = %i[count page_token sort]
727
+ params = {form: form_uri}
728
+ params = merge_options options, opts_keys, params
729
+ body = request :get, 'routing_form_submissions', params: params
730
+
731
+ items = body[:collection] || []
732
+ submissions = items.map { |item| RoutingFormSubmission.new item, self }
733
+ [submissions, next_page_params(body)]
734
+ end
735
+
654
736
  #
655
737
  # Create a scheduling link.
656
738
  #
@@ -50,15 +50,15 @@ module Calendly
50
50
  # Moment when user record was last updated.
51
51
  attr_accessor :updated_at
52
52
 
53
- # @return [EventType]
53
+ # @return [Calendly::EventType]
54
54
  # Reference to Event Type associated with this event.
55
55
  attr_accessor :event_type
56
56
 
57
- # @return [InviteeCancellation]
57
+ # @return [Calendly::InviteeCancellation]
58
58
  # Provides data pertaining to the cancellation of the Invitee.
59
59
  attr_accessor :cancellation
60
60
 
61
- # @return [InviteesCounter]
61
+ # @return [Calendly::InviteesCounter]
62
62
  # invitees counter.
63
63
  attr_accessor :invitees_counter
64
64
 
@@ -66,11 +66,11 @@ module Calendly
66
66
  # location in this event.
67
67
  attr_accessor :location
68
68
 
69
- # @return [Array<User>]
69
+ # @return [Array<Calendly::User>]
70
70
  # Event membership list.
71
71
  attr_accessor :event_memberships
72
72
 
73
- # @return [Array<Guest>]
73
+ # @return [Array<Calendly::Guest>]
74
74
  # Additional people added to an event by an invitee.
75
75
  attr_accessor :event_guests
76
76
 
@@ -90,7 +90,7 @@ module Calendly
90
90
  #
91
91
  # @param [Hash] options the optional request parameters. Optional.
92
92
  # @option options [String] :reason reason for cancellation.
93
- # @return [InviteeCancellation]
93
+ # @return [Calendly::InviteeCancellation]
94
94
  # @raise [Calendly::Error] if the uuid is empty.
95
95
  # @raise [Calendly::ApiError] if the api returns error code.
96
96
  # @since 0.11.0
@@ -104,11 +104,9 @@ module Calendly
104
104
  # @param [Hash] options the optional request parameters. Optional.
105
105
  # @option options [Integer] :count Number of rows to return.
106
106
  # @option options [String] :email Filter by email.
107
- # @option options [String] :page_token
108
- # Pass this to get the next portion of collection.
109
- # @option opts [String] :sort Order results by the specified field and directin.
110
- # Accepts comma-separated list of {field}:{direction} values.
111
- # @option opts [String] :status Whether the scheduled event is active or canceled.
107
+ # @option options [String] :page_token Pass this to get the next portion of collection.
108
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
109
+ # @option options [String] :status Whether the scheduled event is active or canceled.
112
110
  # @return [Array<Calendly::Invitee>]
113
111
  # @raise [Calendly::Error] if the uuid is empty.
114
112
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -85,23 +85,23 @@ module Calendly
85
85
  # Moment when event type was last updated.
86
86
  attr_accessor :updated_at
87
87
 
88
- # @return [EventTypeProfile]
88
+ # @return [Calendly::EventTypeProfile]
89
89
  # The profile of the User that's associated with the Event Type.
90
90
  attr_accessor :profile
91
91
 
92
- # @return [Array<EventTypeCustomQuestion>]
92
+ # @return [Array<Calendly::EventTypeCustomQuestion>]
93
93
  # A collection of custom questions.
94
94
  attr_accessor :custom_questions
95
95
 
96
96
  # The owner user if the profile belongs to a "user" (individual).
97
- # @return [User]
97
+ # @return [Calendly::User]
98
98
  # @since 0.6.0
99
99
  def owner_user
100
100
  profile&.owner_user
101
101
  end
102
102
 
103
103
  # The owner team if the profile belongs to a "team".
104
- # @return [Team]
104
+ # @return [Calendly::Team]
105
105
  # @since 0.6.0
106
106
  def owner_team
107
107
  profile&.owner_team
@@ -17,11 +17,11 @@ module Calendly
17
17
  # The unique reference to the user associated with the profile
18
18
  attr_accessor :owner
19
19
 
20
- # @return [User]
20
+ # @return [Calendly::User]
21
21
  # The owner user if the profile belongs to a "user" (individual).
22
22
  attr_accessor :owner_user
23
23
 
24
- # @return [Team]
24
+ # @return [Calendly::Team]
25
25
  # The owner team if the profile belongs to a "team".
26
26
  attr_accessor :owner_team
27
27
 
@@ -16,7 +16,8 @@ module Calendly
16
16
  payment: InviteePayment,
17
17
  no_show: InviteeNoShow,
18
18
  questions_and_answers: InviteeQuestionAndAnswer,
19
- tracking: InviteeTracking
19
+ tracking: InviteeTracking,
20
+ routing_form_submission: RoutingFormSubmission
20
21
  }
21
22
  end
22
23
 
@@ -94,13 +95,13 @@ module Calendly
94
95
  # Moment when user record was last updated.
95
96
  attr_accessor :updated_at
96
97
 
97
- # @return [InviteeCancellation] Provides data pertaining to the cancellation of the Invitee.
98
+ # @return [Calendly::InviteeCancellation] Provides data pertaining to the cancellation of the Invitee.
98
99
  attr_accessor :cancellation
99
100
 
100
- # @return [InviteePayment] Invitee payment.
101
+ # @return [Calendly::InviteePayment] Invitee payment.
101
102
  attr_accessor :payment
102
103
 
103
- # @return [InviteeNoShow, nil]
104
+ # @return [Calendly::InviteeNoShow, nil]
104
105
  # Provides data pertaining to the associated no show for the Invitee.
105
106
  attr_accessor :no_show
106
107
 
@@ -115,6 +116,9 @@ module Calendly
115
116
  # @return [Calendly::InviteeTracking]
116
117
  attr_accessor :tracking
117
118
 
119
+ # @return [Calendly::RoutingFormSubmission, nil]
120
+ attr_accessor :routing_form_submission
121
+
118
122
  #
119
123
  # Get Event Invitee associated with self.
120
124
  #
@@ -25,7 +25,7 @@ module Calendly
25
25
  # The moment when the no show was created.
26
26
  attr_accessor :created_at
27
27
 
28
- # @return [Invitee, nil]
28
+ # @return [Calendly::Invitee, nil]
29
29
  # The associated Invitee.
30
30
  attr_accessor :invitee
31
31
 
@@ -1,39 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Calendly
4
- # Calendly's invitee tracking model.
5
- # Object that represents UTM and Salesforce tracking parameters associated with the invitee.
4
+ # UTM and Salesforce tracking parameters associated with the invitee.
6
5
  class InviteeTracking
7
6
  include ModelUtils
8
-
9
- # @return [String]
10
- # UTM campaign tracking parameter.
11
- attr_accessor :utm_campaign
12
-
13
- # @return [String]
14
- # UTM source tracking parameter.
15
- attr_accessor :utm_source
16
-
17
- # @return [String]
18
- # UTM medium tracking parameter.
19
- attr_accessor :utm_medium
20
-
21
- # @return [String]
22
- # UTM content tracking parameter.
23
- attr_accessor :utm_content
24
-
25
- # @return [String]
26
- # UTM term tracking parameter.
27
- attr_accessor :utm_term
28
-
29
- # @return [String]
30
- # Salesforce Record ID.
31
- attr_accessor :salesforce_uuid
32
-
33
- private
34
-
35
- def inspect_attributes
36
- super + %i[utm_source utm_medium utm_campaign]
37
- end
7
+ include TrackingFields
38
8
  end
39
9
  end
@@ -45,8 +45,7 @@ module Calendly
45
45
  # @option options [Integer] :count Number of rows to return.
46
46
  # @option options [String] :email Filter by email.
47
47
  # @option options [String] :page_token Pass this to get the next portion of collection.
48
- # @option options [String] :sort Order results by the specified field and directin.
49
- # Accepts comma-separated list of {field}:{direction} values.
48
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
50
49
  # @option options [String] :status Filter by status.
51
50
  # @return [Array<Calendly::OrganizationInvitation>]
52
51
  # @raise [Calendly::Error] if the uuid is empty.
@@ -85,8 +84,7 @@ module Calendly
85
84
  # @option options [Boolean] :active Return only active event types if true, only inactive if false, or all event types if this parameter is omitted.
86
85
  # @option options [Integer] :count Number of rows to return.
87
86
  # @option options [String] :page_token Pass this to get the next portion of collection.
88
- # @option options [String] :sort Order results by the specified field and direction.
89
- # Accepts comma-separated list of {field}:{direction} values.
87
+ # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
90
88
  # @return [Array<Calendly::EventType>]
91
89
  # @raise [Calendly::Error] if the uri is empty.
92
90
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -113,8 +111,7 @@ module Calendly
113
111
  # @option options [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by.
114
112
  # @option options [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
115
113
  # @option options [String] :page_token Pass this to get the next portion of collection.
116
- # @option options [String] :sort Order results by the specified field and directin.
117
- # Accepts comma-separated list of {field}:{direction} values.
114
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
118
115
  # @option options [String] :status Whether the scheduled event is active or canceled
119
116
  # @return [Array<Calendly::Event>]
120
117
  # @raise [Calendly::Error] if the uri is empty.
@@ -140,7 +137,6 @@ module Calendly
140
137
  # @option options [Integer] :count Number of rows to return.
141
138
  # @option options [String] :page_token Pass this to get the next portion of collection.
142
139
  # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
143
- # Accepts comma-separated list of {field}:{direction} values.
144
140
  # @return [Array<Calendly::WebhookSubscription>]
145
141
  # @raise [Calendly::Error] if the uri is empty.
146
142
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -173,5 +169,29 @@ module Calendly
173
169
  def create_webhook(url, events, signing_key: nil)
174
170
  client.create_webhook url, events, uri, signing_key: signing_key
175
171
  end
172
+
173
+ #
174
+ # Returns all Routing Forms associated with self.
175
+ #
176
+ # @param [Hash] options the optional request parameters. Optional.
177
+ # @option options [Integer] :count Number of rows to return.
178
+ # @option options [String] :page_token Pass this to get the next portion of collection.
179
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
180
+ # @return [Array<Calendly::RoutingForm>]
181
+ # @raise [Calendly::Error] if the uri is empty.
182
+ # @raise [Calendly::ApiError] if the api returns error code.
183
+ # @since 0.12.0
184
+ def routing_forms(options: nil)
185
+ return @cached_routing_forms if defined?(@cached_routing_forms) && @cached_routing_forms
186
+
187
+ request_proc = proc { |opts| client.routing_forms uri, options: opts }
188
+ @cached_routing_forms = auto_pagination request_proc, options
189
+ end
190
+
191
+ # @since 0.12.0
192
+ def routing_forms!(options: nil)
193
+ @cached_routing_forms = nil
194
+ routing_forms options: options
195
+ end
176
196
  end
177
197
  end
@@ -42,11 +42,11 @@ module Calendly
42
42
  # Moment when the last invitation was sent.
43
43
  attr_accessor :last_sent_at
44
44
 
45
- # @return [Organization]
45
+ # @return [Calendly::Organization]
46
46
  # Reference to Organization associated with this invitation.
47
47
  attr_accessor :organization
48
48
 
49
- # @return [User]
49
+ # @return [Calendly::User]
50
50
  # If a person accepted the invitation, a reference to their User.
51
51
  attr_accessor :user
52
52
 
@@ -38,7 +38,7 @@ module Calendly
38
38
  # Primary account details of a specific user.
39
39
  attr_accessor :user
40
40
 
41
- # @return [Organization]
41
+ # @return [Calendly::Organization]
42
42
  # Reference to Organization associated with this membership.
43
43
  attr_accessor :organization
44
44
 
@@ -70,7 +70,6 @@ module Calendly
70
70
  # @option options [Integer] :count Number of rows to return.
71
71
  # @option options [String] :page_token Pass this to get the next portion of collection.
72
72
  # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
73
- # Accepts comma-separated list of {field}:{direction} values.
74
73
  # @return [Array<Calendly::WebhookSubscription>]
75
74
  # @raise [Calendly::Error] if the organization.uri is empty.
76
75
  # @raise [Calendly::Error] if the user.uri is empty.
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # Calendly's routing form model.
5
+ class RoutingForm
6
+ include ModelUtils
7
+ UUID_RE = %r{\A#{Client::API_HOST}/routing_forms/(#{UUID_FORMAT})\z}.freeze
8
+ TIME_FIELDS = %i[created_at updated_at].freeze
9
+
10
+ def self.association
11
+ {
12
+ organization: Organization,
13
+ questions: RoutingFormQuestion
14
+ }
15
+ end
16
+
17
+ # @return [String]
18
+ # unique id of the RoutingForm object.
19
+ attr_accessor :uuid
20
+
21
+ # @return [String]
22
+ # Canonical reference (unique identifier) for the routing form.
23
+ attr_accessor :uri
24
+
25
+ # @return [String]
26
+ # The routing form name (in human-readable format).
27
+ attr_accessor :name
28
+
29
+ # @return [String]
30
+ # Indicates if the form is in "draft" or "published" status.
31
+ attr_accessor :status
32
+
33
+ # @return [Time]
34
+ # Moment when user record was first created.
35
+ attr_accessor :created_at
36
+
37
+ # @return [Time]
38
+ # Moment when user record was last updated.
39
+ attr_accessor :updated_at
40
+
41
+ # @return [Calendly::Organization]
42
+ # The URI of the organization that's associated with the routing form.
43
+ attr_accessor :organization
44
+
45
+ # @return [Calendly::RoutingFormQuestion]
46
+ # An ordered collection of Routing Form non-deleted questions.
47
+ attr_accessor :questions
48
+
49
+ #
50
+ # Get Routing Form associated with self.
51
+ #
52
+ # @return [Calendly::RoutingForm]
53
+ # @raise [Calendly::Error] if the uuid is empty.
54
+ # @raise [Calendly::ApiError] if the api returns error code.
55
+ # @since 0.12.0
56
+ def fetch
57
+ client.routing_form uuid
58
+ end
59
+
60
+ #
61
+ # Returns all Routing Form Submissions associated with self.
62
+ #
63
+ # @param [Hash] options the optional request parameters. Optional.
64
+ # @option options [Integer] :count Number of rows to return.
65
+ # @option options [String] :page_token Pass this to get the next portion of collection.
66
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
67
+ # @return [Array<Calendly::RoutingFormSubmission>]
68
+ # @raise [Calendly::Error] if the uri is empty.
69
+ # @raise [Calendly::ApiError] if the api returns error code.
70
+ # @since 0.12.0
71
+ def submissions(options: nil)
72
+ return @cached_submissions if defined?(@cached_submissions) && @cached_submissions
73
+
74
+ request_proc = proc { |opts| client.routing_form_submissions uri, options: opts }
75
+ @cached_submissions = auto_pagination request_proc, options
76
+ end
77
+
78
+ # @since 0.12.0
79
+ def submissions!(options: nil)
80
+ @cached_submissions = nil
81
+ submissions options: options
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # Calendly's routing form question model.
5
+ class RoutingFormQuestion
6
+ include ModelUtils
7
+ TIME_FIELDS = %i[created_at updated_at].freeze
8
+
9
+ # @return [String]
10
+ # Unique identifier for the routing form question.
11
+ attr_accessor :uuid
12
+
13
+ # @return [String]
14
+ # Question name (in human-readable format).
15
+ attr_accessor :name
16
+
17
+ # @return [String]
18
+ # Question type: name, text input, email, phone, textarea input, dropdown list or radio button list.
19
+ attr_accessor :type
20
+
21
+ # @return [Boolean]
22
+ # true if an answer to the question is required for respondents to submit the routing form; false if not required.
23
+ attr_accessor :required
24
+
25
+ # @return [Array<String>]
26
+ # The respondent’s option(s) for "select" or "radios" types of questions.
27
+ attr_accessor :answer_choices
28
+ end
29
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # Calendly's routing form submission model.
5
+ class RoutingFormSubmission
6
+ include ModelUtils
7
+ UUID_RE = %r{\A#{Client::API_HOST}/routing_form_submissions/(#{UUID_FORMAT})\z}.freeze
8
+ TIME_FIELDS = %i[created_at updated_at].freeze
9
+
10
+ def self.association
11
+ {
12
+ routing_form: RoutingForm,
13
+ questions_and_answers: RoutingFormSubmissionQuestionAndAnswer,
14
+ tracking: RoutingFormSubmissionTracking,
15
+ result: RoutingFormSubmissionEventTypeResult
16
+ }
17
+ end
18
+
19
+ # @return [String]
20
+ # unique id of the RoutingFormSubmission object.
21
+ attr_accessor :uuid
22
+
23
+ # @return [String]
24
+ # Canonical reference (unique identifier) for the routing form submission.
25
+ attr_accessor :uri
26
+
27
+ # @return [String, nil]
28
+ # The reference to the Invitee resource when routing form submission results in a scheduled meeting.
29
+ attr_accessor :submitter
30
+
31
+ # @return [String, nil]
32
+ # Type of the respondent resource that submitted the form and scheduled a meeting.
33
+ attr_accessor :submitter_type
34
+
35
+ # @return [Time]
36
+ # Moment when user record was first created.
37
+ attr_accessor :created_at
38
+
39
+ # @return [Time]
40
+ # Moment when user record was last updated.
41
+ attr_accessor :updated_at
42
+
43
+ # @return [Calendly::RoutingForm]
44
+ # The routing form that's associated with the submission.
45
+ attr_accessor :routing_form
46
+
47
+ # @return [Array<Calendly::RoutingFormSubmissionQuestionAndAnswer>]
48
+ # All Routing Form Submission questions with answers.
49
+ attr_accessor :questions_and_answers
50
+
51
+ # @return [Calendly::RoutingFormSubmissionTracking]
52
+ # All Routing Form Submission questions with answers.
53
+ attr_accessor :tracking
54
+
55
+ # @return [Calendly::RoutingFormSubmissionEventTypeResult]
56
+ # Information about the event type Routing Form Submission result.
57
+ attr_accessor :result
58
+
59
+ #
60
+ # Get Routing Form Submission associated with self.
61
+ #
62
+ # @return [Calendly::RoutingFormSubmission]
63
+ # @raise [Calendly::Error] if the uuid is empty.
64
+ # @raise [Calendly::ApiError] if the api returns error code.
65
+ # @since 0.12.0
66
+ def fetch
67
+ client.routing_form_submission uuid
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # Event type Routing Form Submission result.
5
+ class RoutingFormSubmissionEventTypeResult
6
+ include ModelUtils
7
+
8
+ # @return [String]
9
+ # If the type is event_type, indicates that the routing form submission resulted in a redirect to an event type booking page.
10
+ # If the type is external_url, indicates that the routing form submission resulted in a redirect to an external URL.
11
+ # If the type is custom_message, indicates if the routing form submission resulted in a custom "thank you" message.
12
+ attr_accessor :type
13
+
14
+ # @return [String, Hash]
15
+ # If the type is event_type, a reference to the event type resource.
16
+ # If the type is external_url, the external URL the respondent were redirected to.
17
+ # If the type is custom_message, contains an Hash with custom message headline and body.
18
+ attr_accessor :value
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # Routing Form Submission question with answer.
5
+ class RoutingFormSubmissionQuestionAndAnswer
6
+ include ModelUtils
7
+
8
+ # @return [String]
9
+ # Unique identifier for the routing form question.
10
+ attr_accessor :question_uuid
11
+ alias uuid question_uuid
12
+
13
+ # @return [String]
14
+ # Question name (in human-readable format).
15
+ attr_accessor :question
16
+
17
+ # @return [String]
18
+ # Answer provided by the respondent when the form was submitted.
19
+ attr_accessor :answer
20
+
21
+ private
22
+
23
+ def inspect_attributes
24
+ super + %i[question]
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # UTM and Salesforce tracking parameters associated with a Routing Form Submission.
5
+ class RoutingFormSubmissionTracking
6
+ include ModelUtils
7
+ include TrackingFields
8
+ end
9
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Calendly
4
+ # UTM and Salesforce tracking parameters.
5
+ module TrackingFields
6
+ # @return [String]
7
+ # UTM campaign tracking parameter.
8
+ attr_accessor :utm_campaign
9
+
10
+ # @return [String]
11
+ # UTM source tracking parameter.
12
+ attr_accessor :utm_source
13
+
14
+ # @return [String]
15
+ # UTM medium tracking parameter.
16
+ attr_accessor :utm_medium
17
+
18
+ # @return [String]
19
+ # UTM content tracking parameter.
20
+ attr_accessor :utm_content
21
+
22
+ # @return [String]
23
+ # UTM term tracking parameter.
24
+ attr_accessor :utm_term
25
+
26
+ # @return [String]
27
+ # Salesforce Record ID.
28
+ attr_accessor :salesforce_uuid
29
+
30
+ private
31
+
32
+ def inspect_attributes
33
+ super + %i[utm_source utm_medium utm_campaign]
34
+ end
35
+ end
36
+ end
@@ -54,7 +54,7 @@ module Calendly
54
54
  # Moment when user record was last updated.
55
55
  attr_accessor :updated_at
56
56
 
57
- # @return [Organization]
57
+ # @return [Calendly::Organization]
58
58
  # user's current organization
59
59
  attr_accessor :current_organization
60
60
 
@@ -97,8 +97,7 @@ module Calendly
97
97
  # @option options [Boolean] :active Return only active event types if true, only inactive if false, or all event types if this parameter is omitted.
98
98
  # @option options [Integer] :count Number of rows to return.
99
99
  # @option options [String] :page_token Pass this to get the next portion of collection.
100
- # @option options [String] :sort Order results by the specified field and direction.
101
- # Accepts comma-separated list of {field}:{direction} values.
100
+ # @option options [String] :sort Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
102
101
  # @return [Array<Calendly::EventType>]
103
102
  # @raise [Calendly::Error] if the uri is empty.
104
103
  # @raise [Calendly::ApiError] if the api returns error code.
@@ -125,8 +124,7 @@ module Calendly
125
124
  # @option options [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by.
126
125
  # @option options [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by.
127
126
  # @option options [String] :page_token Pass this to get the next portion of collection.
128
- # @option options [String] :sort Order results by the specified field and directin.
129
- # Accepts comma-separated list of {field}:{direction} values.
127
+ # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
130
128
  # @option options [String] :status Whether the scheduled event is active or canceled
131
129
  # @return [Array<Calendly::Event>]
132
130
  # @raise [Calendly::Error] if the uri is empty.
@@ -152,7 +150,6 @@ module Calendly
152
150
  # @option options [Integer] :count Number of rows to return.
153
151
  # @option options [String] :page_token Pass this to get the next portion of collection.
154
152
  # @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values.
155
- # Accepts comma-separated list of {field}:{direction} values.
156
153
  # @return [Array<Calendly::WebhookSubscription>]
157
154
  # @raise [Calendly::Error] if the organization.uri is empty.
158
155
  # @raise [Calendly::Error] if the uri is empty.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Calendly
4
- VERSION = '0.11.1'
4
+ VERSION = '0.12.0'
5
5
  end
data/lib/calendly.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'calendly/client'
4
4
  require 'calendly/models/model_utils'
5
+ require 'calendly/models/tracking_fields'
5
6
  Dir[
6
7
  File.join(
7
8
  File.dirname(__FILE__),
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-29 00:00:00.000000000 Z
11
+ date: 2022-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: oauth2
14
+ name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.4'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 1.4.4
19
+ version: 1.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.4'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
- version: 1.4.4
29
+ version: 1.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: faraday
34
+ name: oauth2
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.0.0
40
- - - "<"
39
+ version: '1.4'
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.0.0
42
+ version: 1.4.4
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 1.0.0
50
- - - "<"
49
+ version: '1.4'
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 3.0.0
52
+ version: 1.4.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +191,14 @@ files:
191
191
  - lib/calendly/models/organization.rb
192
192
  - lib/calendly/models/organization_invitation.rb
193
193
  - lib/calendly/models/organization_membership.rb
194
+ - lib/calendly/models/routing_form.rb
195
+ - lib/calendly/models/routing_form_question.rb
196
+ - lib/calendly/models/routing_form_submission.rb
197
+ - lib/calendly/models/routing_form_submission_event_type_result.rb
198
+ - lib/calendly/models/routing_form_submission_question_and_answer.rb
199
+ - lib/calendly/models/routing_form_submission_tracking.rb
194
200
  - lib/calendly/models/team.rb
201
+ - lib/calendly/models/tracking_fields.rb
195
202
  - lib/calendly/models/user.rb
196
203
  - lib/calendly/models/webhook_subscription.rb
197
204
  - lib/calendly/version.rb
@@ -202,7 +209,7 @@ metadata:
202
209
  homepage_uri: https://github.com/koshilife/calendly-api-ruby-client
203
210
  source_code_uri: https://github.com/koshilife/calendly-api-ruby-client
204
211
  changelog_uri: https://github.com/koshilife/calendly-api-ruby-client/blob/master/CHANGELOG.md
205
- documentation_uri: https://www.rubydoc.info/gems/calendly/0.11.1
212
+ documentation_uri: https://www.rubydoc.info/gems/calendly/0.12.0
206
213
  post_install_message:
207
214
  rdoc_options: []
208
215
  require_paths: