rcs 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rcs/send/client.rb +53 -12
- data/lib/rcs/send/types/rcs_fallback.rb +84 -0
- data/lib/rcs/types/action.rb +14 -6
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bcabdc33fdbabdd3b7cfc7978a324d98e093c8a0b07d39114785fbab248fd60
|
4
|
+
data.tar.gz: 7c1dd8ac26f8eca62e4c3a219cb5e1fc8d658ec61133251467a94daf5f13b525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9681f12bdeeab84a1a7e41be608aea3b3ca9c5c978aea029218ec5d91e0f1db9eb5bceab473249acc28b82dd8d5b016302f57d61d1e322b22978ca11b5a3b33b
|
7
|
+
data.tar.gz: a6b0153c40257cc2e1443cd4247c0cb572014dae19f970e70eb569c031018a7ee6f2d8e9d3ee8baec18b7c0c9b3711a7b387e497a0a638ef1e04f196152201f7
|
data/lib/rcs/send/client.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "../../requests"
|
4
4
|
require_relative "../types/card"
|
5
5
|
require_relative "../types/action"
|
6
|
+
require_relative "types/rcs_fallback"
|
6
7
|
require_relative "types/send_rcs_response"
|
7
8
|
require_relative "types/send_sms_response"
|
8
9
|
require_relative "types/send_mms_response"
|
@@ -54,6 +55,12 @@ module Pinnacle
|
|
54
55
|
# * :lat_long (Hash)
|
55
56
|
# * :lat (Float)
|
56
57
|
# * :lng (Float)
|
58
|
+
# @param fallback [Hash] Request of type Pinnacle::Send::RcsFallback, as a Hash
|
59
|
+
# * :from (String)
|
60
|
+
# * :text (String)
|
61
|
+
# * :media_urls (Array<String>)
|
62
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
63
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
57
64
|
# @param request_options [Pinnacle::RequestOptions]
|
58
65
|
# @return [Pinnacle::Send::SendRcsResponse]
|
59
66
|
# @example
|
@@ -63,7 +70,8 @@ module Pinnacle
|
|
63
70
|
# api_key: "YOUR_API_KEY"
|
64
71
|
# )
|
65
72
|
# api.send.rcs(from: "from", to: "to")
|
66
|
-
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil,
|
73
|
+
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, fallback: nil, status_callback: nil,
|
74
|
+
request_options: nil)
|
67
75
|
response = @request_client.conn.post do |req|
|
68
76
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
69
77
|
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -82,7 +90,9 @@ module Pinnacle
|
|
82
90
|
text: text,
|
83
91
|
mediaUrl: media_url,
|
84
92
|
cards: cards,
|
85
|
-
quickReplies: quick_replies
|
93
|
+
quickReplies: quick_replies,
|
94
|
+
fallback: fallback,
|
95
|
+
statusCallback: status_callback
|
86
96
|
}.compact
|
87
97
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
|
88
98
|
end
|
@@ -94,6 +104,8 @@ module Pinnacle
|
|
94
104
|
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
95
105
|
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
96
106
|
# @param text [String] The SMS message content (max 1600 characters).
|
107
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
108
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
97
109
|
# @param request_options [Pinnacle::RequestOptions]
|
98
110
|
# @return [Pinnacle::Send::SendSmsResponse]
|
99
111
|
# @example
|
@@ -107,7 +119,7 @@ module Pinnacle
|
|
107
119
|
# from: "from",
|
108
120
|
# text: "text"
|
109
121
|
# )
|
110
|
-
def sms(to:, from:, text:, request_options: nil)
|
122
|
+
def sms(to:, from:, text:, status_callback: nil, request_options: nil)
|
111
123
|
response = @request_client.conn.post do |req|
|
112
124
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
113
125
|
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -119,7 +131,13 @@ module Pinnacle
|
|
119
131
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
120
132
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
121
133
|
end
|
122
|
-
req.body = {
|
134
|
+
req.body = {
|
135
|
+
**(request_options&.additional_body_parameters || {}),
|
136
|
+
to: to,
|
137
|
+
from: from,
|
138
|
+
text: text,
|
139
|
+
statusCallback: status_callback
|
140
|
+
}.compact
|
123
141
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/sms"
|
124
142
|
end
|
125
143
|
Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body)
|
@@ -133,6 +151,8 @@ module Pinnacle
|
|
133
151
|
# @param media_urls [Array<String>] The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
|
134
152
|
# fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up
|
135
153
|
# to 10 media URLs can be included.
|
154
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
155
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
136
156
|
# @param request_options [Pinnacle::RequestOptions]
|
137
157
|
# @return [Pinnacle::Send::SendMmsResponse]
|
138
158
|
# @example
|
@@ -146,7 +166,7 @@ module Pinnacle
|
|
146
166
|
# from: "from",
|
147
167
|
# media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
|
148
168
|
# )
|
149
|
-
def mms(to:, from:, media_urls:, text: nil, request_options: nil)
|
169
|
+
def mms(to:, from:, media_urls:, text: nil, status_callback: nil, request_options: nil)
|
150
170
|
response = @request_client.conn.post do |req|
|
151
171
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
152
172
|
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -163,7 +183,8 @@ module Pinnacle
|
|
163
183
|
to: to,
|
164
184
|
from: from,
|
165
185
|
text: text,
|
166
|
-
mediaUrls: media_urls
|
186
|
+
mediaUrls: media_urls,
|
187
|
+
statusCallback: status_callback
|
167
188
|
}.compact
|
168
189
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
|
169
190
|
end
|
@@ -216,6 +237,12 @@ module Pinnacle
|
|
216
237
|
# * :lat_long (Hash)
|
217
238
|
# * :lat (Float)
|
218
239
|
# * :lng (Float)
|
240
|
+
# @param fallback [Hash] Request of type Pinnacle::Send::RcsFallback, as a Hash
|
241
|
+
# * :from (String)
|
242
|
+
# * :text (String)
|
243
|
+
# * :media_urls (Array<String>)
|
244
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
245
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
219
246
|
# @param request_options [Pinnacle::RequestOptions]
|
220
247
|
# @return [Pinnacle::Send::SendRcsResponse]
|
221
248
|
# @example
|
@@ -225,7 +252,8 @@ module Pinnacle
|
|
225
252
|
# api_key: "YOUR_API_KEY"
|
226
253
|
# )
|
227
254
|
# api.send.rcs(from: "from", to: "to")
|
228
|
-
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil,
|
255
|
+
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, fallback: nil, status_callback: nil,
|
256
|
+
request_options: nil)
|
229
257
|
Async do
|
230
258
|
response = @request_client.conn.post do |req|
|
231
259
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -245,7 +273,9 @@ module Pinnacle
|
|
245
273
|
text: text,
|
246
274
|
mediaUrl: media_url,
|
247
275
|
cards: cards,
|
248
|
-
quickReplies: quick_replies
|
276
|
+
quickReplies: quick_replies,
|
277
|
+
fallback: fallback,
|
278
|
+
statusCallback: status_callback
|
249
279
|
}.compact
|
250
280
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
|
251
281
|
end
|
@@ -258,6 +288,8 @@ module Pinnacle
|
|
258
288
|
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
259
289
|
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
260
290
|
# @param text [String] The SMS message content (max 1600 characters).
|
291
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
292
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
261
293
|
# @param request_options [Pinnacle::RequestOptions]
|
262
294
|
# @return [Pinnacle::Send::SendSmsResponse]
|
263
295
|
# @example
|
@@ -271,7 +303,7 @@ module Pinnacle
|
|
271
303
|
# from: "from",
|
272
304
|
# text: "text"
|
273
305
|
# )
|
274
|
-
def sms(to:, from:, text:, request_options: nil)
|
306
|
+
def sms(to:, from:, text:, status_callback: nil, request_options: nil)
|
275
307
|
Async do
|
276
308
|
response = @request_client.conn.post do |req|
|
277
309
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -284,7 +316,13 @@ module Pinnacle
|
|
284
316
|
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
285
317
|
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
286
318
|
end
|
287
|
-
req.body = {
|
319
|
+
req.body = {
|
320
|
+
**(request_options&.additional_body_parameters || {}),
|
321
|
+
to: to,
|
322
|
+
from: from,
|
323
|
+
text: text,
|
324
|
+
statusCallback: status_callback
|
325
|
+
}.compact
|
288
326
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/sms"
|
289
327
|
end
|
290
328
|
Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body)
|
@@ -299,6 +337,8 @@ module Pinnacle
|
|
299
337
|
# @param media_urls [Array<String>] The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
|
300
338
|
# fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up
|
301
339
|
# to 10 media URLs can be included.
|
340
|
+
# @param status_callback [String] Optional URL to receive a POST request when the message status changes. Read
|
341
|
+
# more about status callbacks [here](/api-reference/receive-msg-statuses).
|
302
342
|
# @param request_options [Pinnacle::RequestOptions]
|
303
343
|
# @return [Pinnacle::Send::SendMmsResponse]
|
304
344
|
# @example
|
@@ -312,7 +352,7 @@ module Pinnacle
|
|
312
352
|
# from: "from",
|
313
353
|
# media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
|
314
354
|
# )
|
315
|
-
def mms(to:, from:, media_urls:, text: nil, request_options: nil)
|
355
|
+
def mms(to:, from:, media_urls:, text: nil, status_callback: nil, request_options: nil)
|
316
356
|
Async do
|
317
357
|
response = @request_client.conn.post do |req|
|
318
358
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
@@ -330,7 +370,8 @@ module Pinnacle
|
|
330
370
|
to: to,
|
331
371
|
from: from,
|
332
372
|
text: text,
|
333
|
-
mediaUrls: media_urls
|
373
|
+
mediaUrls: media_urls,
|
374
|
+
statusCallback: status_callback
|
334
375
|
}.compact
|
335
376
|
req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
|
336
377
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Send
|
8
|
+
class RcsFallback
|
9
|
+
# @return [String] The sender's phone number in E.164 format. Must be owned by the user.
|
10
|
+
attr_reader :from
|
11
|
+
# @return [String] The fallback message content (max 1600 characters). One of 'text' or 'mediaUrls'
|
12
|
+
# must be provided.
|
13
|
+
attr_reader :text
|
14
|
+
# @return [Array<String>] The URLs of media to include. One of 'text' or 'mediaUrls' must be provided.
|
15
|
+
# `jpeg`, `jpg`, `gif`, and `png` file types are fully supported and have a size
|
16
|
+
# limit of 5 MB. 500 KB limit for other types. Up to 10 media URLs can be
|
17
|
+
# included.
|
18
|
+
attr_reader :media_urls
|
19
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
attr_reader :additional_properties
|
21
|
+
# @return [Object]
|
22
|
+
attr_reader :_field_set
|
23
|
+
protected :_field_set
|
24
|
+
|
25
|
+
OMIT = Object.new
|
26
|
+
|
27
|
+
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
28
|
+
# @param text [String] The fallback message content (max 1600 characters). One of 'text' or 'mediaUrls'
|
29
|
+
# must be provided.
|
30
|
+
# @param media_urls [Array<String>] The URLs of media to include. One of 'text' or 'mediaUrls' must be provided.
|
31
|
+
# `jpeg`, `jpg`, `gif`, and `png` file types are fully supported and have a size
|
32
|
+
# limit of 5 MB. 500 KB limit for other types. Up to 10 media URLs can be
|
33
|
+
# included.
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
35
|
+
# @return [Pinnacle::Send::RcsFallback]
|
36
|
+
def initialize(from: OMIT, text: OMIT, media_urls: OMIT, additional_properties: nil)
|
37
|
+
@from = from if from != OMIT
|
38
|
+
@text = text if text != OMIT
|
39
|
+
@media_urls = media_urls if media_urls != OMIT
|
40
|
+
@additional_properties = additional_properties
|
41
|
+
@_field_set = { "from": from, "text": text, "mediaUrls": media_urls }.reject do |_k, v|
|
42
|
+
v == OMIT
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Deserialize a JSON object to an instance of RcsFallback
|
47
|
+
#
|
48
|
+
# @param json_object [String]
|
49
|
+
# @return [Pinnacle::Send::RcsFallback]
|
50
|
+
def self.from_json(json_object:)
|
51
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
52
|
+
parsed_json = JSON.parse(json_object)
|
53
|
+
from = parsed_json["from"]
|
54
|
+
text = parsed_json["text"]
|
55
|
+
media_urls = parsed_json["mediaUrls"]
|
56
|
+
new(
|
57
|
+
from: from,
|
58
|
+
text: text,
|
59
|
+
media_urls: media_urls,
|
60
|
+
additional_properties: struct
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Serialize an instance of RcsFallback to a JSON object
|
65
|
+
#
|
66
|
+
# @return [String]
|
67
|
+
def to_json(*_args)
|
68
|
+
@_field_set&.to_json
|
69
|
+
end
|
70
|
+
|
71
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
72
|
+
# hash and check each fields type against the current object's property
|
73
|
+
# definitions.
|
74
|
+
#
|
75
|
+
# @param obj [Object]
|
76
|
+
# @return [Void]
|
77
|
+
def self.validate_raw(obj:)
|
78
|
+
obj.from&.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
|
79
|
+
obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
80
|
+
obj.media_urls&.is_a?(Array) != false || raise("Passed value for field obj.media_urls is not the expected type, validation failed.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/rcs/types/action.rb
CHANGED
@@ -19,11 +19,15 @@ module Pinnacle
|
|
19
19
|
# URL to open. For 'call', the payload is the phone number to dial. For 'trigger',
|
20
20
|
# the payload is the predefined payload to send to the webhook.
|
21
21
|
attr_reader :payload
|
22
|
-
# @return [String] Optional metadata.
|
22
|
+
# @return [String] Optional metadata. Only used for type 'trigger' ignored for other action types.
|
23
|
+
# When the user presses the action, the metadata is sent to the webhook alongside
|
24
|
+
# the payload.
|
23
25
|
attr_reader :metadata
|
24
|
-
# @return [String] Start time for events.
|
26
|
+
# @return [String] Start time for events in ISO 8601 format. For example, '2022-01-01T12:00:00Z'.
|
27
|
+
# Required for 'scheduleEvent'.
|
25
28
|
attr_reader :event_start_time
|
26
|
-
# @return [String] End time for events.
|
29
|
+
# @return [String] End time for events in ISO 8601 format. For example, '2022-01-01T12:00:00Z'.
|
30
|
+
# Required for 'scheduleEvent'.
|
27
31
|
attr_reader :event_end_time
|
28
32
|
# @return [String] Event title. Required for 'scheduleEvent'.
|
29
33
|
attr_reader :event_title
|
@@ -48,9 +52,13 @@ module Pinnacle
|
|
48
52
|
# fields for the action type and is required. For 'openUrl', the payload is the
|
49
53
|
# URL to open. For 'call', the payload is the phone number to dial. For 'trigger',
|
50
54
|
# the payload is the predefined payload to send to the webhook.
|
51
|
-
# @param metadata [String] Optional metadata.
|
52
|
-
#
|
53
|
-
#
|
55
|
+
# @param metadata [String] Optional metadata. Only used for type 'trigger' ignored for other action types.
|
56
|
+
# When the user presses the action, the metadata is sent to the webhook alongside
|
57
|
+
# the payload.
|
58
|
+
# @param event_start_time [String] Start time for events in ISO 8601 format. For example, '2022-01-01T12:00:00Z'.
|
59
|
+
# Required for 'scheduleEvent'.
|
60
|
+
# @param event_end_time [String] End time for events in ISO 8601 format. For example, '2022-01-01T12:00:00Z'.
|
61
|
+
# Required for 'scheduleEvent'.
|
54
62
|
# @param event_title [String] Event title. Required for 'scheduleEvent'.
|
55
63
|
# @param event_description [String] Optional event description.
|
56
64
|
# @param lat_long [Pinnacle::ActionLatLong] Latitude and longitude coordinates. Required for 'sendLocation'.
|
data/lib/requests.rb
CHANGED
@@ -43,7 +43,7 @@ module Pinnacle
|
|
43
43
|
|
44
44
|
# @return [Hash{String => String}]
|
45
45
|
def get_headers
|
46
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.
|
46
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.12" }
|
47
47
|
headers["PINNACLE-API-Key"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
48
48
|
headers
|
49
49
|
end
|
@@ -87,7 +87,7 @@ module Pinnacle
|
|
87
87
|
|
88
88
|
# @return [Hash{String => String}]
|
89
89
|
def get_headers
|
90
|
-
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.
|
90
|
+
headers = { "X-Fern-Language": "Ruby", "X-Fern-SDK-Name": "rcs", "X-Fern-SDK-Version": "1.0.12" }
|
91
91
|
headers["PINNACLE-API-Key"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
|
92
92
|
headers
|
93
93
|
end
|
data/lib/types_export.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative "rcs/company/types/company_register_response_brand"
|
|
4
4
|
require_relative "rcs/company/types/company_register_response"
|
5
5
|
require_relative "rcs/company/types/company_update_response_brand"
|
6
6
|
require_relative "rcs/company/types/company_update_response"
|
7
|
+
require_relative "rcs/send/types/rcs_fallback"
|
7
8
|
require_relative "rcs/send/types/send_rcs_response"
|
8
9
|
require_relative "rcs/send/types/send_sms_response"
|
9
10
|
require_relative "rcs/send/types/send_mms_response"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http-faraday
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/rcs/company/types/company_update_response.rb
|
106
106
|
- lib/rcs/company/types/company_update_response_brand.rb
|
107
107
|
- lib/rcs/send/client.rb
|
108
|
+
- lib/rcs/send/types/rcs_fallback.rb
|
108
109
|
- lib/rcs/send/types/send_mms_response.rb
|
109
110
|
- lib/rcs/send/types/send_rcs_response.rb
|
110
111
|
- lib/rcs/send/types/send_sms_response.rb
|