rcs 1.0.14 → 1.0.16

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: 7c64d425bcacc2baf86894e594e3e03d7227f5c7221ad06c944a90138011d5fe
4
- data.tar.gz: c3f8a91fdfacd860df015784ec8d51af1c91c0913f68cffc12a9f064614215bf
3
+ metadata.gz: 0cc0ed650419f2955313e2c91055c00a20c376af7b19fca0a067c575e39cb441
4
+ data.tar.gz: 0114e52c609971adb0f70222a9eda7be72ed2c21cbaab3edf6412a3586419c4d
5
5
  SHA512:
6
- metadata.gz: 50f8276cace3809d5a71d693115c584a68261e36970e46365124d6690d6aecdcbfff0cf67ecf661da9f3d82fc8ade6237e3b173bcf85a367453ed30167f75287
7
- data.tar.gz: e9f306e9917eaa8afd72388d7a0a46e83eced1d1e7da446a20ea9c4289c25a1e5fd1a2e78cb829b96a7ccdc77ad028f5a676201470b804960ea7d6c4a7508200
6
+ metadata.gz: f814ccaa8ebb9566fd17e1f5d067605f60ef77e5becb1e66c336eb6feda96aa42b384d3d04dcfb6ec89ae0e2d4e48d0516750b7c0c35fafc52cbb2faf139cb53
7
+ data.tar.gz: 1c5530bf2ad1d6589b6e445929ca77aa7dd0e80c726faa93cda11e4e335fb0002aa8bad60f9f2de9ca4d60f34b18a8a9118c3bf416b6d292412d5639654ab274
@@ -5,6 +5,7 @@ require_relative "../types/company"
5
5
  require "json"
6
6
  require_relative "../types/company_details"
7
7
  require_relative "../types/company_contact"
8
+ require_relative "../types/messaging"
8
9
  require_relative "../types/point_of_contact"
9
10
  require_relative "../types/optionals"
10
11
  require_relative "types/company_register_response"
@@ -66,6 +67,7 @@ module Pinnacle
66
67
  #
67
68
  # @param company [Hash] Request of type Pinnacle::CompanyDetails, as a Hash
68
69
  # * :name (String)
70
+ # * :category (Pinnacle::CompanyCategory)
69
71
  # * :address (String)
70
72
  # * :ein (String)
71
73
  # * :description (String)
@@ -81,6 +83,12 @@ module Pinnacle
81
83
  # * :primary_email_label (String)
82
84
  # * :privacy_policy_url (String)
83
85
  # * :tos_url (String)
86
+ # @param messaging [Hash] Request of type Pinnacle::Messaging, as a Hash
87
+ # * :opt_in (String)
88
+ # * :opt_out (String)
89
+ # * :opt_out_keywords (Array<String>)
90
+ # * :agent_use_case (String)
91
+ # * :expected_agent_responses (String)
84
92
  # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
85
93
  # * :poc_name (String)
86
94
  # * :poc_title (String)
@@ -99,11 +107,17 @@ module Pinnacle
99
107
  # api_key: "YOUR_API_KEY"
100
108
  # )
101
109
  # api.company.register(
102
- # company: { name: "name", address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
110
+ # company: { name: "name", category: ENTERTAINMENT, address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
103
111
  # company_contact: { primary_website_url: "primaryWebsiteUrl", primary_website_label: "primaryWebsiteLabel", primary_phone: "primaryPhone", primary_phone_label: "primaryPhoneLabel", primary_email: "primaryEmail", primary_email_label: "primaryEmailLabel", privacy_policy_url: "privacyPolicyUrl", tos_url: "tosUrl" },
112
+ # messaging: { opt_in: "By opting in, you agree to receive messages from Pinnacle, including updates and promotions. Reply “STOP” to unsubscribe. Standard message and data rates may apply.", opt_out: "Reply with keywords like STOP or UNSUBSCRIBE to opt-out. A confirmation message will be sent, and no further messages will be received unless you re-subscribe.", opt_out_keywords: ["STOP", "UNSUBSCRIBE"], agent_use_case: "Pinnacle’s agent assists with product updates, promotions, order tracking, and support. It answers FAQs, provides order updates, and helps with opt-in/out processes. Escalates to live support when needed.", expected_agent_responses: "General Inquiry: “How can I assist you today?”
113
+ # Order Status: “Provide your order number.”
114
+ # Opt-In: “You’re now subscribed!”
115
+ # Opt-Out: “You have unsubscribed.”
116
+ # Escalation: “Connecting to a live agent.”
117
+ # " },
104
118
  # point_of_contact: { poc_name: "pocName", poc_title: "pocTitle", poc_email: "pocEmail" }
105
119
  # )
106
- def register(company:, company_contact:, point_of_contact:, optionals: nil, request_options: nil)
120
+ def register(company:, company_contact:, messaging:, point_of_contact:, optionals: nil, request_options: nil)
107
121
  response = @request_client.conn.post do |req|
108
122
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
109
123
  req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
@@ -119,6 +133,7 @@ module Pinnacle
119
133
  **(request_options&.additional_body_parameters || {}),
120
134
  company: company,
121
135
  companyContact: company_contact,
136
+ messaging: messaging,
122
137
  pointOfContact: point_of_contact,
123
138
  optionals: optionals
124
139
  }.compact
@@ -134,6 +149,7 @@ module Pinnacle
134
149
  # * :id (Integer)
135
150
  # * :created_at (DateTime)
136
151
  # * :name (String)
152
+ # * :category (Pinnacle::CompanyCategory)
137
153
  # * :address (String)
138
154
  # * :ein (String)
139
155
  # * :description (String)
@@ -151,6 +167,11 @@ module Pinnacle
151
167
  # * :poc_name (String)
152
168
  # * :poc_title (String)
153
169
  # * :poc_email (String)
170
+ # * :opt_in (String)
171
+ # * :opt_out (String)
172
+ # * :opt_out_keywords (Array<String>)
173
+ # * :agent_use_case (String)
174
+ # * :expected_agent_responses (String)
154
175
  # * :test_numbers (Array<String>)
155
176
  # * :status (String)
156
177
  # * :additional_websites (Array<Pinnacle::CompanyAdditionalWebsitesItem>)
@@ -165,6 +186,12 @@ module Pinnacle
165
186
  # * :primary_email_label (String)
166
187
  # * :privacy_policy_url (String)
167
188
  # * :tos_url (String)
189
+ # @param messaging [Hash] Request of type Pinnacle::Messaging, as a Hash
190
+ # * :opt_in (String)
191
+ # * :opt_out (String)
192
+ # * :opt_out_keywords (Array<String>)
193
+ # * :agent_use_case (String)
194
+ # * :expected_agent_responses (String)
168
195
  # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
169
196
  # * :poc_name (String)
170
197
  # * :poc_title (String)
@@ -183,7 +210,7 @@ module Pinnacle
183
210
  # api_key: "YOUR_API_KEY"
184
211
  # )
185
212
  # api.company.update(company_id: "companyId")
186
- def update(company_id:, company: nil, company_contact: nil, point_of_contact: nil, optionals: nil,
213
+ def update(company_id:, company: nil, company_contact: nil, messaging: nil, point_of_contact: nil, optionals: nil,
187
214
  request_options: nil)
188
215
  response = @request_client.conn.post do |req|
189
216
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -201,6 +228,7 @@ module Pinnacle
201
228
  companyId: company_id,
202
229
  company: company,
203
230
  companyContact: company_contact,
231
+ messaging: messaging,
204
232
  pointOfContact: point_of_contact,
205
233
  optionals: optionals
206
234
  }.compact
@@ -266,6 +294,7 @@ module Pinnacle
266
294
  #
267
295
  # @param company [Hash] Request of type Pinnacle::CompanyDetails, as a Hash
268
296
  # * :name (String)
297
+ # * :category (Pinnacle::CompanyCategory)
269
298
  # * :address (String)
270
299
  # * :ein (String)
271
300
  # * :description (String)
@@ -281,6 +310,12 @@ module Pinnacle
281
310
  # * :primary_email_label (String)
282
311
  # * :privacy_policy_url (String)
283
312
  # * :tos_url (String)
313
+ # @param messaging [Hash] Request of type Pinnacle::Messaging, as a Hash
314
+ # * :opt_in (String)
315
+ # * :opt_out (String)
316
+ # * :opt_out_keywords (Array<String>)
317
+ # * :agent_use_case (String)
318
+ # * :expected_agent_responses (String)
284
319
  # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
285
320
  # * :poc_name (String)
286
321
  # * :poc_title (String)
@@ -299,11 +334,17 @@ module Pinnacle
299
334
  # api_key: "YOUR_API_KEY"
300
335
  # )
301
336
  # api.company.register(
302
- # company: { name: "name", address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
337
+ # company: { name: "name", category: ENTERTAINMENT, address: "address", ein: "ein", description: "description", brand_color: "brandColor", logo_url: "logoUrl", hero_url: "heroUrl" },
303
338
  # company_contact: { primary_website_url: "primaryWebsiteUrl", primary_website_label: "primaryWebsiteLabel", primary_phone: "primaryPhone", primary_phone_label: "primaryPhoneLabel", primary_email: "primaryEmail", primary_email_label: "primaryEmailLabel", privacy_policy_url: "privacyPolicyUrl", tos_url: "tosUrl" },
339
+ # messaging: { opt_in: "By opting in, you agree to receive messages from Pinnacle, including updates and promotions. Reply “STOP” to unsubscribe. Standard message and data rates may apply.", opt_out: "Reply with keywords like STOP or UNSUBSCRIBE to opt-out. A confirmation message will be sent, and no further messages will be received unless you re-subscribe.", opt_out_keywords: ["STOP", "UNSUBSCRIBE"], agent_use_case: "Pinnacle’s agent assists with product updates, promotions, order tracking, and support. It answers FAQs, provides order updates, and helps with opt-in/out processes. Escalates to live support when needed.", expected_agent_responses: "General Inquiry: “How can I assist you today?”
340
+ # Order Status: “Provide your order number.”
341
+ # Opt-In: “You’re now subscribed!”
342
+ # Opt-Out: “You have unsubscribed.”
343
+ # Escalation: “Connecting to a live agent.”
344
+ # " },
304
345
  # point_of_contact: { poc_name: "pocName", poc_title: "pocTitle", poc_email: "pocEmail" }
305
346
  # )
306
- def register(company:, company_contact:, point_of_contact:, optionals: nil, request_options: nil)
347
+ def register(company:, company_contact:, messaging:, point_of_contact:, optionals: nil, request_options: nil)
307
348
  Async do
308
349
  response = @request_client.conn.post do |req|
309
350
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -320,6 +361,7 @@ module Pinnacle
320
361
  **(request_options&.additional_body_parameters || {}),
321
362
  company: company,
322
363
  companyContact: company_contact,
364
+ messaging: messaging,
323
365
  pointOfContact: point_of_contact,
324
366
  optionals: optionals
325
367
  }.compact
@@ -336,6 +378,7 @@ module Pinnacle
336
378
  # * :id (Integer)
337
379
  # * :created_at (DateTime)
338
380
  # * :name (String)
381
+ # * :category (Pinnacle::CompanyCategory)
339
382
  # * :address (String)
340
383
  # * :ein (String)
341
384
  # * :description (String)
@@ -353,6 +396,11 @@ module Pinnacle
353
396
  # * :poc_name (String)
354
397
  # * :poc_title (String)
355
398
  # * :poc_email (String)
399
+ # * :opt_in (String)
400
+ # * :opt_out (String)
401
+ # * :opt_out_keywords (Array<String>)
402
+ # * :agent_use_case (String)
403
+ # * :expected_agent_responses (String)
356
404
  # * :test_numbers (Array<String>)
357
405
  # * :status (String)
358
406
  # * :additional_websites (Array<Pinnacle::CompanyAdditionalWebsitesItem>)
@@ -367,6 +415,12 @@ module Pinnacle
367
415
  # * :primary_email_label (String)
368
416
  # * :privacy_policy_url (String)
369
417
  # * :tos_url (String)
418
+ # @param messaging [Hash] Request of type Pinnacle::Messaging, as a Hash
419
+ # * :opt_in (String)
420
+ # * :opt_out (String)
421
+ # * :opt_out_keywords (Array<String>)
422
+ # * :agent_use_case (String)
423
+ # * :expected_agent_responses (String)
370
424
  # @param point_of_contact [Hash] Request of type Pinnacle::PointOfContact, as a Hash
371
425
  # * :poc_name (String)
372
426
  # * :poc_title (String)
@@ -385,7 +439,7 @@ module Pinnacle
385
439
  # api_key: "YOUR_API_KEY"
386
440
  # )
387
441
  # api.company.update(company_id: "companyId")
388
- def update(company_id:, company: nil, company_contact: nil, point_of_contact: nil, optionals: nil,
442
+ def update(company_id:, company: nil, company_contact: nil, messaging: nil, point_of_contact: nil, optionals: nil,
389
443
  request_options: nil)
390
444
  Async do
391
445
  response = @request_client.conn.post do |req|
@@ -404,6 +458,7 @@ module Pinnacle
404
458
  companyId: company_id,
405
459
  company: company,
406
460
  companyContact: company_contact,
461
+ messaging: messaging,
407
462
  pointOfContact: point_of_contact,
408
463
  optionals: optionals
409
464
  }.compact
@@ -0,0 +1,207 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../requests"
4
+ require "date"
5
+ require_relative "types/tools_shorten_url_response"
6
+ require_relative "types/tools_upload_url_response"
7
+ require "async"
8
+
9
+ module Pinnacle
10
+ class ToolsClient
11
+ # @return [Pinnacle::RequestClient]
12
+ attr_reader :request_client
13
+
14
+ # @param request_client [Pinnacle::RequestClient]
15
+ # @return [Pinnacle::ToolsClient]
16
+ def initialize(request_client:)
17
+ @request_client = request_client
18
+ end
19
+
20
+ # Create a shortened URL with an optional expiration date (default and max
21
+ # expiration is 90 days). The shortened URL will redirect to the original URL and
22
+ # will have the following format https://urls.p1n.io/ABCD5678.
23
+ #
24
+ # @param url [String] The URL to be shortened. Must be a valid URL with either http or https protocol.
25
+ # @param expires_at [DateTime] Optional expiration date for the shortened URL in ISO 8601 format. Default and
26
+ # max expiration is 90 days.
27
+ # @param request_options [Pinnacle::RequestOptions]
28
+ # @return [Pinnacle::Tools::ToolsShortenUrlResponse]
29
+ # @example
30
+ # api = Pinnacle::Client.new(
31
+ # base_url: "https://api.example.com",
32
+ # environment: Pinnacle::Environment::DEFAULT,
33
+ # api_key: "YOUR_API_KEY"
34
+ # )
35
+ # api.tools.shorten_url(url: "https://example.com")
36
+ def shorten_url(url:, expires_at: nil, request_options: nil)
37
+ response = @request_client.conn.post do |req|
38
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
39
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
40
+ req.headers = {
41
+ **(req.headers || {}),
42
+ **@request_client.get_headers,
43
+ **(request_options&.additional_headers || {})
44
+ }.compact
45
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
46
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
47
+ end
48
+ req.body = { **(request_options&.additional_body_parameters || {}), url: url, expiresAt: expires_at }.compact
49
+ req.url "#{@request_client.get_url(request_options: request_options)}/tools/urls/shorten"
50
+ end
51
+ Pinnacle::Tools::ToolsShortenUrlResponse.from_json(json_object: response.body)
52
+ end
53
+
54
+ # Generate signed upload (expires in 2 hours) and download URLs for a file
55
+ # (expires in 1 hour).
56
+ #
57
+ # @param content_type [String] The MIME type of the file.
58
+ # Supported types are audio/basic, audio/L24, audio/mp4, audio/mpeg, audio/mpg,
59
+ # audio/mp3, audio/ogg, audio/aac, audio/vndrn-realaudio, audio/vndwave,
60
+ # audio/3gpp, audio/3gpp2, audio/ac3, audio/webm, audio/amrnb, audio/amr,
61
+ # video/mpeg, video/mp4, video/quicktime, video/webm, video/3gpp, video/3gpp2,
62
+ # video/3gpptt, video/H261, video/H263, video/H2631998, video/H2632000,
63
+ # video/H264, video/m4v, video/mpeg4, video/webm, image/jpeg, image/gif,
64
+ # image/png, image/gif, image/bmp, image/tiff, image/webp, text/vcard,
65
+ # text/xvcard, text/csv, text/rtf, text/richtext, text/calendar, text/directory,
66
+ # application/ogg, application/pdf, application/vcard,
67
+ # application/vndapple.pkpass.
68
+ # @param size [Integer] The size of the file in bytes. Should be less than 100 MB.
69
+ # @param name [String] The name of the file.
70
+ # @param request_options [Pinnacle::RequestOptions]
71
+ # @return [Pinnacle::Tools::ToolsUploadUrlResponse]
72
+ # @example
73
+ # api = Pinnacle::Client.new(
74
+ # base_url: "https://api.example.com",
75
+ # environment: Pinnacle::Environment::DEFAULT,
76
+ # api_key: "YOUR_API_KEY"
77
+ # )
78
+ # api.tools.upload_url(
79
+ # content_type: "image/png",
80
+ # size: 1024,
81
+ # name: "example.png"
82
+ # )
83
+ def upload_url(content_type:, size:, name:, request_options: nil)
84
+ response = @request_client.conn.post do |req|
85
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
86
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
87
+ req.headers = {
88
+ **(req.headers || {}),
89
+ **@request_client.get_headers,
90
+ **(request_options&.additional_headers || {})
91
+ }.compact
92
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
93
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
94
+ end
95
+ req.body = {
96
+ **(request_options&.additional_body_parameters || {}),
97
+ contentType: content_type,
98
+ size: size,
99
+ name: name
100
+ }.compact
101
+ req.url "#{@request_client.get_url(request_options: request_options)}/tools/uploadUrl"
102
+ end
103
+ Pinnacle::Tools::ToolsUploadUrlResponse.from_json(json_object: response.body)
104
+ end
105
+ end
106
+
107
+ class AsyncToolsClient
108
+ # @return [Pinnacle::AsyncRequestClient]
109
+ attr_reader :request_client
110
+
111
+ # @param request_client [Pinnacle::AsyncRequestClient]
112
+ # @return [Pinnacle::AsyncToolsClient]
113
+ def initialize(request_client:)
114
+ @request_client = request_client
115
+ end
116
+
117
+ # Create a shortened URL with an optional expiration date (default and max
118
+ # expiration is 90 days). The shortened URL will redirect to the original URL and
119
+ # will have the following format https://urls.p1n.io/ABCD5678.
120
+ #
121
+ # @param url [String] The URL to be shortened. Must be a valid URL with either http or https protocol.
122
+ # @param expires_at [DateTime] Optional expiration date for the shortened URL in ISO 8601 format. Default and
123
+ # max expiration is 90 days.
124
+ # @param request_options [Pinnacle::RequestOptions]
125
+ # @return [Pinnacle::Tools::ToolsShortenUrlResponse]
126
+ # @example
127
+ # api = Pinnacle::Client.new(
128
+ # base_url: "https://api.example.com",
129
+ # environment: Pinnacle::Environment::DEFAULT,
130
+ # api_key: "YOUR_API_KEY"
131
+ # )
132
+ # api.tools.shorten_url(url: "https://example.com")
133
+ def shorten_url(url:, expires_at: nil, request_options: nil)
134
+ Async do
135
+ response = @request_client.conn.post do |req|
136
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
137
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
138
+ req.headers = {
139
+ **(req.headers || {}),
140
+ **@request_client.get_headers,
141
+ **(request_options&.additional_headers || {})
142
+ }.compact
143
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
144
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
145
+ end
146
+ req.body = { **(request_options&.additional_body_parameters || {}), url: url, expiresAt: expires_at }.compact
147
+ req.url "#{@request_client.get_url(request_options: request_options)}/tools/urls/shorten"
148
+ end
149
+ Pinnacle::Tools::ToolsShortenUrlResponse.from_json(json_object: response.body)
150
+ end
151
+ end
152
+
153
+ # Generate signed upload (expires in 2 hours) and download URLs for a file
154
+ # (expires in 1 hour).
155
+ #
156
+ # @param content_type [String] The MIME type of the file.
157
+ # Supported types are audio/basic, audio/L24, audio/mp4, audio/mpeg, audio/mpg,
158
+ # audio/mp3, audio/ogg, audio/aac, audio/vndrn-realaudio, audio/vndwave,
159
+ # audio/3gpp, audio/3gpp2, audio/ac3, audio/webm, audio/amrnb, audio/amr,
160
+ # video/mpeg, video/mp4, video/quicktime, video/webm, video/3gpp, video/3gpp2,
161
+ # video/3gpptt, video/H261, video/H263, video/H2631998, video/H2632000,
162
+ # video/H264, video/m4v, video/mpeg4, video/webm, image/jpeg, image/gif,
163
+ # image/png, image/gif, image/bmp, image/tiff, image/webp, text/vcard,
164
+ # text/xvcard, text/csv, text/rtf, text/richtext, text/calendar, text/directory,
165
+ # application/ogg, application/pdf, application/vcard,
166
+ # application/vndapple.pkpass.
167
+ # @param size [Integer] The size of the file in bytes. Should be less than 100 MB.
168
+ # @param name [String] The name of the file.
169
+ # @param request_options [Pinnacle::RequestOptions]
170
+ # @return [Pinnacle::Tools::ToolsUploadUrlResponse]
171
+ # @example
172
+ # api = Pinnacle::Client.new(
173
+ # base_url: "https://api.example.com",
174
+ # environment: Pinnacle::Environment::DEFAULT,
175
+ # api_key: "YOUR_API_KEY"
176
+ # )
177
+ # api.tools.upload_url(
178
+ # content_type: "image/png",
179
+ # size: 1024,
180
+ # name: "example.png"
181
+ # )
182
+ def upload_url(content_type:, size:, name:, request_options: nil)
183
+ Async do
184
+ response = @request_client.conn.post do |req|
185
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
186
+ req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
187
+ req.headers = {
188
+ **(req.headers || {}),
189
+ **@request_client.get_headers,
190
+ **(request_options&.additional_headers || {})
191
+ }.compact
192
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
193
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
194
+ end
195
+ req.body = {
196
+ **(request_options&.additional_body_parameters || {}),
197
+ contentType: content_type,
198
+ size: size,
199
+ name: name
200
+ }.compact
201
+ req.url "#{@request_client.get_url(request_options: request_options)}/tools/uploadUrl"
202
+ end
203
+ Pinnacle::Tools::ToolsUploadUrlResponse.from_json(json_object: response.body)
204
+ end
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Pinnacle
8
+ class Tools
9
+ class ToolsShortenUrlResponse
10
+ # @return [String] The shortened URL.
11
+ attr_reader :shortened_url
12
+ # @return [DateTime] The expiration date of the shortened URL, if provided.
13
+ attr_reader :expires_at
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param shortened_url [String] The shortened URL.
23
+ # @param expires_at [DateTime] The expiration date of the shortened URL, if provided.
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [Pinnacle::Tools::ToolsShortenUrlResponse]
26
+ def initialize(shortened_url: OMIT, expires_at: OMIT, additional_properties: nil)
27
+ @shortened_url = shortened_url if shortened_url != OMIT
28
+ @expires_at = expires_at if expires_at != OMIT
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "shortenedUrl": shortened_url, "expiresAt": expires_at }.reject do |_k, v|
31
+ v == OMIT
32
+ end
33
+ end
34
+
35
+ # Deserialize a JSON object to an instance of ToolsShortenUrlResponse
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Pinnacle::Tools::ToolsShortenUrlResponse]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ shortened_url = parsed_json["shortenedUrl"]
43
+ expires_at = (DateTime.parse(parsed_json["expiresAt"]) unless parsed_json["expiresAt"].nil?)
44
+ new(
45
+ shortened_url: shortened_url,
46
+ expires_at: expires_at,
47
+ additional_properties: struct
48
+ )
49
+ end
50
+
51
+ # Serialize an instance of ToolsShortenUrlResponse to a JSON object
52
+ #
53
+ # @return [String]
54
+ def to_json(*_args)
55
+ @_field_set&.to_json
56
+ end
57
+
58
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
59
+ # hash and check each fields type against the current object's property
60
+ # definitions.
61
+ #
62
+ # @param obj [Object]
63
+ # @return [Void]
64
+ def self.validate_raw(obj:)
65
+ obj.shortened_url&.is_a?(String) != false || raise("Passed value for field obj.shortened_url is not the expected type, validation failed.")
66
+ obj.expires_at&.is_a?(DateTime) != false || raise("Passed value for field obj.expires_at is not the expected type, validation failed.")
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ class Tools
8
+ class ToolsUploadUrlResponse
9
+ # @return [String] The URL to upload the file.
10
+ attr_reader :upload
11
+ # @return [String] The URL to download the file.
12
+ attr_reader :download
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param upload [String] The URL to upload the file.
22
+ # @param download [String] The URL to download the file.
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Pinnacle::Tools::ToolsUploadUrlResponse]
25
+ def initialize(upload: OMIT, download: OMIT, additional_properties: nil)
26
+ @upload = upload if upload != OMIT
27
+ @download = download if download != OMIT
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "upload": upload, "download": download }.reject do |_k, v|
30
+ v == OMIT
31
+ end
32
+ end
33
+
34
+ # Deserialize a JSON object to an instance of ToolsUploadUrlResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [Pinnacle::Tools::ToolsUploadUrlResponse]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ upload = parsed_json["upload"]
42
+ download = parsed_json["download"]
43
+ new(
44
+ upload: upload,
45
+ download: download,
46
+ additional_properties: struct
47
+ )
48
+ end
49
+
50
+ # Serialize an instance of ToolsUploadUrlResponse to a JSON object
51
+ #
52
+ # @return [String]
53
+ def to_json(*_args)
54
+ @_field_set&.to_json
55
+ end
56
+
57
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
58
+ # hash and check each fields type against the current object's property
59
+ # definitions.
60
+ #
61
+ # @param obj [Object]
62
+ # @return [Void]
63
+ def self.validate_raw(obj:)
64
+ obj.upload&.is_a?(String) != false || raise("Passed value for field obj.upload is not the expected type, validation failed.")
65
+ obj.download&.is_a?(String) != false || raise("Passed value for field obj.download is not the expected type, validation failed.")
66
+ end
67
+ end
68
+ end
69
+ end