rcs 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/rcs/company/client.rb +416 -0
- data/lib/rcs/company/types/company_register_response.rb +63 -0
- data/lib/rcs/company/types/company_register_response_brand.rb +67 -0
- data/lib/rcs/company/types/company_update_response.rb +63 -0
- data/lib/rcs/company/types/company_update_response_brand.rb +67 -0
- data/lib/rcs/send/client.rb +343 -0
- data/lib/rcs/send/types/send_mms_response.rb +67 -0
- data/lib/rcs/send/types/send_rcs_response.rb +67 -0
- data/lib/rcs/send/types/send_sms_response.rb +67 -0
- data/lib/rcs/types/action.rb +146 -0
- data/lib/rcs/types/action_lat_long.rb +68 -0
- data/lib/rcs/types/action_type.rb +16 -0
- data/lib/rcs/types/additional_email.rb +65 -0
- data/lib/rcs/types/additional_phone_number.rb +65 -0
- data/lib/rcs/types/additional_website.rb +65 -0
- data/lib/rcs/types/bad_request_error_body.rb +57 -0
- data/lib/rcs/types/card.rb +90 -0
- data/lib/rcs/types/company.rb +268 -0
- data/lib/rcs/types/company_additional_emails_item.rb +67 -0
- data/lib/rcs/types/company_additional_phone_numbers_item.rb +67 -0
- data/lib/rcs/types/company_additional_websites_item.rb +67 -0
- data/lib/rcs/types/company_contact.rb +117 -0
- data/lib/rcs/types/company_details.rb +110 -0
- data/lib/rcs/types/forbidden_error_body.rb +57 -0
- data/lib/rcs/types/internal_server_error_body.rb +57 -0
- data/lib/rcs/types/optionals.rb +99 -0
- data/lib/rcs/types/point_of_contact.rb +72 -0
- data/lib/rcs/types/rcs_functionalities.rb +117 -0
- data/lib/rcs/types/unauthorized_error_body.rb +57 -0
- data/lib/rcs.rb +126 -0
- data/lib/requests.rb +163 -0
- data/lib/types_export.rb +29 -0
- metadata +158 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Company
|
8
|
+
class CompanyUpdateResponseBrand
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :name
|
11
|
+
# @return [Float]
|
12
|
+
attr_reader :id
|
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 name [String]
|
22
|
+
# @param id [Float]
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
# @return [Pinnacle::Company::CompanyUpdateResponseBrand]
|
25
|
+
def initialize(name:, id:, additional_properties: nil)
|
26
|
+
@name = name
|
27
|
+
@id = id
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
@_field_set = { "name": name, "id": id }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of CompanyUpdateResponseBrand
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Pinnacle::Company::CompanyUpdateResponseBrand]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
parsed_json = JSON.parse(json_object)
|
39
|
+
name = parsed_json["name"]
|
40
|
+
id = parsed_json["id"]
|
41
|
+
new(
|
42
|
+
name: name,
|
43
|
+
id: id,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of CompanyUpdateResponseBrand to a JSON object
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
def to_json(*_args)
|
52
|
+
@_field_set&.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
63
|
+
obj.id.is_a?(Float) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,343 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "../types/card"
|
5
|
+
require_relative "../types/action"
|
6
|
+
require_relative "types/send_rcs_response"
|
7
|
+
require_relative "types/send_sms_response"
|
8
|
+
require_relative "types/send_mms_response"
|
9
|
+
require "async"
|
10
|
+
|
11
|
+
module Pinnacle
|
12
|
+
class SendClient
|
13
|
+
# @return [Pinnacle::RequestClient]
|
14
|
+
attr_reader :request_client
|
15
|
+
|
16
|
+
# @param request_client [Pinnacle::RequestClient]
|
17
|
+
# @return [Pinnacle::SendClient]
|
18
|
+
def initialize(request_client:)
|
19
|
+
@request_client = request_client
|
20
|
+
end
|
21
|
+
|
22
|
+
# Send an interactive RCS message with text, media, or cards. Each message can
|
23
|
+
# only contain either text, media, or card(s).
|
24
|
+
# Quick replies can also be added to the message.
|
25
|
+
#
|
26
|
+
# @param from [String] The id of the RCS agent sending the message.
|
27
|
+
# Use 'test' if you want to send from the Pinnacle test agent. The test agent can
|
28
|
+
# only send to whitelisted test numbers.
|
29
|
+
# See https://dashboard.trypinnacle.app/settings/test-numbers to whitelist a
|
30
|
+
# number.
|
31
|
+
# @param to [String] The recipient's RCS-enabled phone number in E.164 format (e.g., +12345678901).
|
32
|
+
# @param text [String] Text content of the message.
|
33
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
34
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.
|
35
|
+
# @param media_url [String] Media URL to be included in the message.
|
36
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
37
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.
|
38
|
+
# @param cards [Array<Hash>] List of rich cards. Maximum of 10 cards.
|
39
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
40
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.Request of type Array<Pinnacle::Card>, as a Hash
|
41
|
+
# * :title (String)
|
42
|
+
# * :subtitle (String)
|
43
|
+
# * :media_url (String)
|
44
|
+
# * :buttons (Array<Pinnacle::Action>)
|
45
|
+
# @param quick_replies [Array<Hash>] Optional list of quick reply actions (max 10).Request of type Array<Pinnacle::Action>, as a Hash
|
46
|
+
# * :title (String)
|
47
|
+
# * :type (Pinnacle::ActionType)
|
48
|
+
# * :payload (String)
|
49
|
+
# * :metadata (String)
|
50
|
+
# * :event_start_time (String)
|
51
|
+
# * :event_end_time (String)
|
52
|
+
# * :event_title (String)
|
53
|
+
# * :event_description (String)
|
54
|
+
# * :lat_long (Hash)
|
55
|
+
# * :lat (Float)
|
56
|
+
# * :lng (Float)
|
57
|
+
# @param request_options [Pinnacle::RequestOptions]
|
58
|
+
# @return [Pinnacle::Send::SendRcsResponse]
|
59
|
+
# @example
|
60
|
+
# api = Pinnacle::Client.new(
|
61
|
+
# base_url: "https://api.example.com",
|
62
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
63
|
+
# api_key: "YOUR_API_KEY"
|
64
|
+
# )
|
65
|
+
# api.send.rcs(from: "from", to: "to")
|
66
|
+
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, request_options: nil)
|
67
|
+
response = @request_client.conn.post do |req|
|
68
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
69
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
70
|
+
req.headers = {
|
71
|
+
**(req.headers || {}),
|
72
|
+
**@request_client.get_headers,
|
73
|
+
**(request_options&.additional_headers || {})
|
74
|
+
}.compact
|
75
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
76
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
77
|
+
end
|
78
|
+
req.body = {
|
79
|
+
**(request_options&.additional_body_parameters || {}),
|
80
|
+
from: from,
|
81
|
+
to: to,
|
82
|
+
text: text,
|
83
|
+
mediaUrl: media_url,
|
84
|
+
cards: cards,
|
85
|
+
quickReplies: quick_replies
|
86
|
+
}.compact
|
87
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
|
88
|
+
end
|
89
|
+
Pinnacle::Send::SendRcsResponse.from_json(json_object: response.body)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Send an SMS message to a recipient.
|
93
|
+
#
|
94
|
+
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
95
|
+
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
96
|
+
# @param text [String] The SMS message content (max 1600 characters).
|
97
|
+
# @param request_options [Pinnacle::RequestOptions]
|
98
|
+
# @return [Pinnacle::Send::SendSmsResponse]
|
99
|
+
# @example
|
100
|
+
# api = Pinnacle::Client.new(
|
101
|
+
# base_url: "https://api.example.com",
|
102
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
103
|
+
# api_key: "YOUR_API_KEY"
|
104
|
+
# )
|
105
|
+
# api.send.sms(
|
106
|
+
# to: "to",
|
107
|
+
# from: "from",
|
108
|
+
# text: "text"
|
109
|
+
# )
|
110
|
+
def sms(to:, from:, text:, request_options: nil)
|
111
|
+
response = @request_client.conn.post do |req|
|
112
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
113
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
114
|
+
req.headers = {
|
115
|
+
**(req.headers || {}),
|
116
|
+
**@request_client.get_headers,
|
117
|
+
**(request_options&.additional_headers || {})
|
118
|
+
}.compact
|
119
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
120
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
121
|
+
end
|
122
|
+
req.body = { **(request_options&.additional_body_parameters || {}), to: to, from: from, text: text }.compact
|
123
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/sms"
|
124
|
+
end
|
125
|
+
Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Send an MMS message with media attachments.
|
129
|
+
#
|
130
|
+
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
131
|
+
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
132
|
+
# @param text [String] The MMS message content (max 1600 characters).
|
133
|
+
# @param media_urls [Array<String>] The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
|
134
|
+
# fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up
|
135
|
+
# to 10 media URLs can be included.
|
136
|
+
# @param request_options [Pinnacle::RequestOptions]
|
137
|
+
# @return [Pinnacle::Send::SendMmsResponse]
|
138
|
+
# @example
|
139
|
+
# api = Pinnacle::Client.new(
|
140
|
+
# base_url: "https://api.example.com",
|
141
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
142
|
+
# api_key: "YOUR_API_KEY"
|
143
|
+
# )
|
144
|
+
# api.send.mms(
|
145
|
+
# to: "to",
|
146
|
+
# from: "from",
|
147
|
+
# text: "text",
|
148
|
+
# media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
|
149
|
+
# )
|
150
|
+
def mms(to:, from:, text:, media_urls:, request_options: nil)
|
151
|
+
response = @request_client.conn.post do |req|
|
152
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
153
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
154
|
+
req.headers = {
|
155
|
+
**(req.headers || {}),
|
156
|
+
**@request_client.get_headers,
|
157
|
+
**(request_options&.additional_headers || {})
|
158
|
+
}.compact
|
159
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
160
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
161
|
+
end
|
162
|
+
req.body = {
|
163
|
+
**(request_options&.additional_body_parameters || {}),
|
164
|
+
to: to,
|
165
|
+
from: from,
|
166
|
+
text: text,
|
167
|
+
mediaUrls: media_urls
|
168
|
+
}.compact
|
169
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
|
170
|
+
end
|
171
|
+
Pinnacle::Send::SendMmsResponse.from_json(json_object: response.body)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
class AsyncSendClient
|
176
|
+
# @return [Pinnacle::AsyncRequestClient]
|
177
|
+
attr_reader :request_client
|
178
|
+
|
179
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
180
|
+
# @return [Pinnacle::AsyncSendClient]
|
181
|
+
def initialize(request_client:)
|
182
|
+
@request_client = request_client
|
183
|
+
end
|
184
|
+
|
185
|
+
# Send an interactive RCS message with text, media, or cards. Each message can
|
186
|
+
# only contain either text, media, or card(s).
|
187
|
+
# Quick replies can also be added to the message.
|
188
|
+
#
|
189
|
+
# @param from [String] The id of the RCS agent sending the message.
|
190
|
+
# Use 'test' if you want to send from the Pinnacle test agent. The test agent can
|
191
|
+
# only send to whitelisted test numbers.
|
192
|
+
# See https://dashboard.trypinnacle.app/settings/test-numbers to whitelist a
|
193
|
+
# number.
|
194
|
+
# @param to [String] The recipient's RCS-enabled phone number in E.164 format (e.g., +12345678901).
|
195
|
+
# @param text [String] Text content of the message.
|
196
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
197
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.
|
198
|
+
# @param media_url [String] Media URL to be included in the message.
|
199
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
200
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.
|
201
|
+
# @param cards [Array<Hash>] List of rich cards. Maximum of 10 cards.
|
202
|
+
# Make sure you have either 'text', 'mediaUrl', or 'cards'. An error will be
|
203
|
+
# thrown if multiple (i.e. both 'text' and 'mediaUrl') is provided.Request of type Array<Pinnacle::Card>, as a Hash
|
204
|
+
# * :title (String)
|
205
|
+
# * :subtitle (String)
|
206
|
+
# * :media_url (String)
|
207
|
+
# * :buttons (Array<Pinnacle::Action>)
|
208
|
+
# @param quick_replies [Array<Hash>] Optional list of quick reply actions (max 10).Request of type Array<Pinnacle::Action>, as a Hash
|
209
|
+
# * :title (String)
|
210
|
+
# * :type (Pinnacle::ActionType)
|
211
|
+
# * :payload (String)
|
212
|
+
# * :metadata (String)
|
213
|
+
# * :event_start_time (String)
|
214
|
+
# * :event_end_time (String)
|
215
|
+
# * :event_title (String)
|
216
|
+
# * :event_description (String)
|
217
|
+
# * :lat_long (Hash)
|
218
|
+
# * :lat (Float)
|
219
|
+
# * :lng (Float)
|
220
|
+
# @param request_options [Pinnacle::RequestOptions]
|
221
|
+
# @return [Pinnacle::Send::SendRcsResponse]
|
222
|
+
# @example
|
223
|
+
# api = Pinnacle::Client.new(
|
224
|
+
# base_url: "https://api.example.com",
|
225
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
226
|
+
# api_key: "YOUR_API_KEY"
|
227
|
+
# )
|
228
|
+
# api.send.rcs(from: "from", to: "to")
|
229
|
+
def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, request_options: nil)
|
230
|
+
Async do
|
231
|
+
response = @request_client.conn.post do |req|
|
232
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
233
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
234
|
+
req.headers = {
|
235
|
+
**(req.headers || {}),
|
236
|
+
**@request_client.get_headers,
|
237
|
+
**(request_options&.additional_headers || {})
|
238
|
+
}.compact
|
239
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
240
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
241
|
+
end
|
242
|
+
req.body = {
|
243
|
+
**(request_options&.additional_body_parameters || {}),
|
244
|
+
from: from,
|
245
|
+
to: to,
|
246
|
+
text: text,
|
247
|
+
mediaUrl: media_url,
|
248
|
+
cards: cards,
|
249
|
+
quickReplies: quick_replies
|
250
|
+
}.compact
|
251
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
|
252
|
+
end
|
253
|
+
Pinnacle::Send::SendRcsResponse.from_json(json_object: response.body)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# Send an SMS message to a recipient.
|
258
|
+
#
|
259
|
+
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
260
|
+
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
261
|
+
# @param text [String] The SMS message content (max 1600 characters).
|
262
|
+
# @param request_options [Pinnacle::RequestOptions]
|
263
|
+
# @return [Pinnacle::Send::SendSmsResponse]
|
264
|
+
# @example
|
265
|
+
# api = Pinnacle::Client.new(
|
266
|
+
# base_url: "https://api.example.com",
|
267
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
268
|
+
# api_key: "YOUR_API_KEY"
|
269
|
+
# )
|
270
|
+
# api.send.sms(
|
271
|
+
# to: "to",
|
272
|
+
# from: "from",
|
273
|
+
# text: "text"
|
274
|
+
# )
|
275
|
+
def sms(to:, from:, text:, request_options: nil)
|
276
|
+
Async do
|
277
|
+
response = @request_client.conn.post do |req|
|
278
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
279
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
280
|
+
req.headers = {
|
281
|
+
**(req.headers || {}),
|
282
|
+
**@request_client.get_headers,
|
283
|
+
**(request_options&.additional_headers || {})
|
284
|
+
}.compact
|
285
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
286
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
287
|
+
end
|
288
|
+
req.body = { **(request_options&.additional_body_parameters || {}), to: to, from: from, text: text }.compact
|
289
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/sms"
|
290
|
+
end
|
291
|
+
Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
# Send an MMS message with media attachments.
|
296
|
+
#
|
297
|
+
# @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
|
298
|
+
# @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
|
299
|
+
# @param text [String] The MMS message content (max 1600 characters).
|
300
|
+
# @param media_urls [Array<String>] The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
|
301
|
+
# fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up
|
302
|
+
# to 10 media URLs can be included.
|
303
|
+
# @param request_options [Pinnacle::RequestOptions]
|
304
|
+
# @return [Pinnacle::Send::SendMmsResponse]
|
305
|
+
# @example
|
306
|
+
# api = Pinnacle::Client.new(
|
307
|
+
# base_url: "https://api.example.com",
|
308
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
309
|
+
# api_key: "YOUR_API_KEY"
|
310
|
+
# )
|
311
|
+
# api.send.mms(
|
312
|
+
# to: "to",
|
313
|
+
# from: "from",
|
314
|
+
# text: "text",
|
315
|
+
# media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
|
316
|
+
# )
|
317
|
+
def mms(to:, from:, text:, media_urls:, request_options: nil)
|
318
|
+
Async do
|
319
|
+
response = @request_client.conn.post do |req|
|
320
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
321
|
+
req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
|
322
|
+
req.headers = {
|
323
|
+
**(req.headers || {}),
|
324
|
+
**@request_client.get_headers,
|
325
|
+
**(request_options&.additional_headers || {})
|
326
|
+
}.compact
|
327
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
328
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
329
|
+
end
|
330
|
+
req.body = {
|
331
|
+
**(request_options&.additional_body_parameters || {}),
|
332
|
+
to: to,
|
333
|
+
from: from,
|
334
|
+
text: text,
|
335
|
+
mediaUrls: media_urls
|
336
|
+
}.compact
|
337
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
|
338
|
+
end
|
339
|
+
Pinnacle::Send::SendMmsResponse.from_json(json_object: response.body)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Send
|
8
|
+
class SendMmsResponse
|
9
|
+
# @return [String] The unique ID of the sent message.
|
10
|
+
attr_reader :message_id
|
11
|
+
# @return [String] A message indicating the status of the sent message.
|
12
|
+
attr_reader :message
|
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 message_id [String] The unique ID of the sent message.
|
22
|
+
# @param message [String] A message indicating the status of the sent message.
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
# @return [Pinnacle::Send::SendMmsResponse]
|
25
|
+
def initialize(message_id:, message:, additional_properties: nil)
|
26
|
+
@message_id = message_id
|
27
|
+
@message = message
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
@_field_set = { "messageId": message_id, "message": message }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of SendMmsResponse
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Pinnacle::Send::SendMmsResponse]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
parsed_json = JSON.parse(json_object)
|
39
|
+
message_id = parsed_json["messageId"]
|
40
|
+
message = parsed_json["message"]
|
41
|
+
new(
|
42
|
+
message_id: message_id,
|
43
|
+
message: message,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of SendMmsResponse to a JSON object
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
def to_json(*_args)
|
52
|
+
@_field_set&.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.message_id.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.")
|
63
|
+
obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Send
|
8
|
+
class SendRcsResponse
|
9
|
+
# @return [String] The unique ID of the sent message.
|
10
|
+
attr_reader :message_id
|
11
|
+
# @return [String] A message indicating the status of the sent message.
|
12
|
+
attr_reader :message
|
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 message_id [String] The unique ID of the sent message.
|
22
|
+
# @param message [String] A message indicating the status of the sent message.
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
# @return [Pinnacle::Send::SendRcsResponse]
|
25
|
+
def initialize(message_id:, message:, additional_properties: nil)
|
26
|
+
@message_id = message_id
|
27
|
+
@message = message
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
@_field_set = { "messageId": message_id, "message": message }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of SendRcsResponse
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Pinnacle::Send::SendRcsResponse]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
parsed_json = JSON.parse(json_object)
|
39
|
+
message_id = parsed_json["messageId"]
|
40
|
+
message = parsed_json["message"]
|
41
|
+
new(
|
42
|
+
message_id: message_id,
|
43
|
+
message: message,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of SendRcsResponse to a JSON object
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
def to_json(*_args)
|
52
|
+
@_field_set&.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.message_id.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.")
|
63
|
+
obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Pinnacle
|
7
|
+
class Send
|
8
|
+
class SendSmsResponse
|
9
|
+
# @return [String] The unique ID of the sent message.
|
10
|
+
attr_reader :message_id
|
11
|
+
# @return [String] A message indicating the status of the sent message.
|
12
|
+
attr_reader :message
|
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 message_id [String] The unique ID of the sent message.
|
22
|
+
# @param message [String] A message indicating the status of the sent message.
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
# @return [Pinnacle::Send::SendSmsResponse]
|
25
|
+
def initialize(message_id:, message:, additional_properties: nil)
|
26
|
+
@message_id = message_id
|
27
|
+
@message = message
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
@_field_set = { "messageId": message_id, "message": message }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of SendSmsResponse
|
33
|
+
#
|
34
|
+
# @param json_object [String]
|
35
|
+
# @return [Pinnacle::Send::SendSmsResponse]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
parsed_json = JSON.parse(json_object)
|
39
|
+
message_id = parsed_json["messageId"]
|
40
|
+
message = parsed_json["message"]
|
41
|
+
new(
|
42
|
+
message_id: message_id,
|
43
|
+
message: message,
|
44
|
+
additional_properties: struct
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of SendSmsResponse to a JSON object
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
def to_json(*_args)
|
52
|
+
@_field_set&.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
56
|
+
# hash and check each fields type against the current object's property
|
57
|
+
# definitions.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.message_id.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.")
|
63
|
+
obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|