rcs 1.0.10 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f65329659fa99fc103cbac99eca161f7703560a665a9e8c2a60c7ccc6555e074
4
- data.tar.gz: d81483384221c609fa37dad833cb683d2c8fc3d516a08024f87cb3c922eeaf1d
3
+ metadata.gz: 7bcabdc33fdbabdd3b7cfc7978a324d98e093c8a0b07d39114785fbab248fd60
4
+ data.tar.gz: 7c1dd8ac26f8eca62e4c3a219cb5e1fc8d658ec61133251467a94daf5f13b525
5
5
  SHA512:
6
- metadata.gz: fb28d812c14f45fed3c74e32e0e6177fd939b1b94e3fc2941b43d3ad556fde1729ab9b41c66185c9f5ba8d2cc82706016a17b9c0bfae595544d0f339fca91a8e
7
- data.tar.gz: 42c5b7d35da195ab0b37031792e5badf9721d3b9ed69a67c3b1de9deb1bbecbfe1690a1f25ecccce8322f311994e0006406d7e3362e3cc0c047a32c0bc9e36eb
6
+ metadata.gz: 9681f12bdeeab84a1a7e41be608aea3b3ca9c5c978aea029218ec5d91e0f1db9eb5bceab473249acc28b82dd8d5b016302f57d61d1e322b22978ca11b5a3b33b
7
+ data.tar.gz: a6b0153c40257cc2e1443cd4247c0cb572014dae19f970e70eb569c031018a7ee6f2d8e9d3ee8baec18b7c0c9b3711a7b387e497a0a638ef1e04f196152201f7
@@ -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, request_options: 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 = { **(request_options&.additional_body_parameters || {}), to: to, from: from, text: text }.compact
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
@@ -144,10 +164,9 @@ module Pinnacle
144
164
  # api.send.mms(
145
165
  # to: "to",
146
166
  # from: "from",
147
- # text: "text",
148
167
  # media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
149
168
  # )
150
- def mms(to:, from:, text:, media_urls:, request_options: nil)
169
+ def mms(to:, from:, media_urls:, text: nil, status_callback: nil, request_options: nil)
151
170
  response = @request_client.conn.post do |req|
152
171
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
153
172
  req.headers["PINNACLE-API-Key"] = request_options.api_key unless request_options&.api_key.nil?
@@ -164,7 +183,8 @@ module Pinnacle
164
183
  to: to,
165
184
  from: from,
166
185
  text: text,
167
- mediaUrls: media_urls
186
+ mediaUrls: media_urls,
187
+ statusCallback: status_callback
168
188
  }.compact
169
189
  req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
170
190
  end
@@ -217,6 +237,12 @@ module Pinnacle
217
237
  # * :lat_long (Hash)
218
238
  # * :lat (Float)
219
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).
220
246
  # @param request_options [Pinnacle::RequestOptions]
221
247
  # @return [Pinnacle::Send::SendRcsResponse]
222
248
  # @example
@@ -226,7 +252,8 @@ module Pinnacle
226
252
  # api_key: "YOUR_API_KEY"
227
253
  # )
228
254
  # 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)
255
+ def rcs(from:, to:, text: nil, media_url: nil, cards: nil, quick_replies: nil, fallback: nil, status_callback: nil,
256
+ request_options: nil)
230
257
  Async do
231
258
  response = @request_client.conn.post do |req|
232
259
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -246,7 +273,9 @@ module Pinnacle
246
273
  text: text,
247
274
  mediaUrl: media_url,
248
275
  cards: cards,
249
- quickReplies: quick_replies
276
+ quickReplies: quick_replies,
277
+ fallback: fallback,
278
+ statusCallback: status_callback
250
279
  }.compact
251
280
  req.url "#{@request_client.get_url(request_options: request_options)}/send/rcs"
252
281
  end
@@ -259,6 +288,8 @@ module Pinnacle
259
288
  # @param to [String] The recipient's phone number in E.164 format (e.g., +12345678901).
260
289
  # @param from [String] The sender's phone number in E.164 format. Must be owned by the user.
261
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).
262
293
  # @param request_options [Pinnacle::RequestOptions]
263
294
  # @return [Pinnacle::Send::SendSmsResponse]
264
295
  # @example
@@ -272,7 +303,7 @@ module Pinnacle
272
303
  # from: "from",
273
304
  # text: "text"
274
305
  # )
275
- def sms(to:, from:, text:, request_options: nil)
306
+ def sms(to:, from:, text:, status_callback: nil, request_options: nil)
276
307
  Async do
277
308
  response = @request_client.conn.post do |req|
278
309
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -285,7 +316,13 @@ module Pinnacle
285
316
  unless request_options.nil? || request_options&.additional_query_parameters.nil?
286
317
  req.params = { **(request_options&.additional_query_parameters || {}) }.compact
287
318
  end
288
- req.body = { **(request_options&.additional_body_parameters || {}), to: to, from: from, text: text }.compact
319
+ req.body = {
320
+ **(request_options&.additional_body_parameters || {}),
321
+ to: to,
322
+ from: from,
323
+ text: text,
324
+ statusCallback: status_callback
325
+ }.compact
289
326
  req.url "#{@request_client.get_url(request_options: request_options)}/send/sms"
290
327
  end
291
328
  Pinnacle::Send::SendSmsResponse.from_json(json_object: response.body)
@@ -300,6 +337,8 @@ module Pinnacle
300
337
  # @param media_urls [Array<String>] The URLs of media to include. `jpeg`, `jpg`, `gif`, and `png` file types are
301
338
  # fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up
302
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).
303
342
  # @param request_options [Pinnacle::RequestOptions]
304
343
  # @return [Pinnacle::Send::SendMmsResponse]
305
344
  # @example
@@ -311,10 +350,9 @@ module Pinnacle
311
350
  # api.send.mms(
312
351
  # to: "to",
313
352
  # from: "from",
314
- # text: "text",
315
353
  # media_urls: ["https://example.com/image1.jpg", "https://example.com/video.mp4"]
316
354
  # )
317
- def mms(to:, from:, text:, media_urls:, request_options: nil)
355
+ def mms(to:, from:, media_urls:, text: nil, status_callback: nil, request_options: nil)
318
356
  Async do
319
357
  response = @request_client.conn.post do |req|
320
358
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -332,7 +370,8 @@ module Pinnacle
332
370
  to: to,
333
371
  from: from,
334
372
  text: text,
335
- mediaUrls: media_urls
373
+ mediaUrls: media_urls,
374
+ statusCallback: status_callback
336
375
  }.compact
337
376
  req.url "#{@request_client.get_url(request_options: request_options)}/send/mms"
338
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
@@ -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. This is sent alongside the payload to the webhook.
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. Required for 'scheduleEvent'.
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. Required for 'scheduleEvent'.
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. This is sent alongside the payload to the webhook.
52
- # @param event_start_time [String] Start time for events. Required for 'scheduleEvent'.
53
- # @param event_end_time [String] End time for events. Required for 'scheduleEvent'.
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.10" }
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.10" }
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.10
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-10-14 00:00:00.000000000 Z
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