reach-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +1 -0
  3. data/.gitignore +18 -0
  4. data/.rubocop.yml +58 -0
  5. data/.rubocop_todo.yml +193 -0
  6. data/AUTHORS.md +52 -0
  7. data/CHANGES.md +3 -0
  8. data/CODE_OF_CONDUCT.md +73 -0
  9. data/CONTRIBUTING.md +163 -0
  10. data/Dockerfile +9 -0
  11. data/Gemfile +3 -0
  12. data/ISSUE_TEMPLATE.md +30 -0
  13. data/LICENSE +21 -0
  14. data/Makefile +34 -0
  15. data/PULL_REQUEST_TEMPLATE.md +31 -0
  16. data/README.md +237 -0
  17. data/Rakefile +10 -0
  18. data/UPGRADE.md +5 -0
  19. data/VERSIONS.md +35 -0
  20. data/advanced-examples/custom-http-client.md +166 -0
  21. data/examples/examples.rb +23 -0
  22. data/githooks/pre-commit +1 -0
  23. data/lib/rack/reach_webhook_authentication.rb +72 -0
  24. data/lib/reach-ruby/framework/reach_response.rb +19 -0
  25. data/lib/reach-ruby/framework/request.rb +41 -0
  26. data/lib/reach-ruby/framework/response.rb +18 -0
  27. data/lib/reach-ruby/framework/rest/domain.rb +39 -0
  28. data/lib/reach-ruby/framework/rest/error.rb +51 -0
  29. data/lib/reach-ruby/framework/rest/helper.rb +11 -0
  30. data/lib/reach-ruby/framework/rest/page.rb +144 -0
  31. data/lib/reach-ruby/framework/rest/resource.rb +23 -0
  32. data/lib/reach-ruby/framework/rest/version.rb +240 -0
  33. data/lib/reach-ruby/framework/serialize.rb +81 -0
  34. data/lib/reach-ruby/framework/values.rb +9 -0
  35. data/lib/reach-ruby/http/http_client.rb +82 -0
  36. data/lib/reach-ruby/http.rb +5 -0
  37. data/lib/reach-ruby/rest/api/authentix/.openapi-generator/FILES +10 -0
  38. data/lib/reach-ruby/rest/api/authentix/.openapi-generator/VERSION +1 -0
  39. data/lib/reach-ruby/rest/api/authentix/.openapi-generator-ignore +23 -0
  40. data/lib/reach-ruby/rest/api/authentix/authentication_trial_item.rb +418 -0
  41. data/lib/reach-ruby/rest/api/authentix/authentication_trial_stat_item.rb +279 -0
  42. data/lib/reach-ruby/rest/api/authentix/configuration_item/authentication_control_item.rb +214 -0
  43. data/lib/reach-ruby/rest/api/authentix/configuration_item/authentication_item.rb +449 -0
  44. data/lib/reach-ruby/rest/api/authentix/configuration_item.rb +583 -0
  45. data/lib/reach-ruby/rest/api/authentix.rb +72 -0
  46. data/lib/reach-ruby/rest/api/messaging/.openapi-generator/FILES +2 -0
  47. data/lib/reach-ruby/rest/api/messaging/.openapi-generator/VERSION +1 -0
  48. data/lib/reach-ruby/rest/api/messaging/.openapi-generator-ignore +23 -0
  49. data/lib/reach-ruby/rest/api/messaging/messaging_item.rb +582 -0
  50. data/lib/reach-ruby/rest/api/messaging.rb +51 -0
  51. data/lib/reach-ruby/rest/api.rb +50 -0
  52. data/lib/reach-ruby/rest/client.rb +130 -0
  53. data/lib/reach-ruby/rest.rb +13 -0
  54. data/lib/reach-ruby/security/request_validator.rb +149 -0
  55. data/lib/reach-ruby/util/configuration.rb +25 -0
  56. data/lib/reach-ruby/version.rb +3 -0
  57. data/lib/reach-ruby.rb +44 -0
  58. data/reach-ruby.gemspec +38 -0
  59. data/sonar-project.properties +13 -0
  60. metadata +267 -0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
@@ -0,0 +1,582 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ ___ _ ___ _ _ _____ _ _ _ ___ ___ _ ___ ___ ___ _ ___ ___ ___ _ _ ___ ___ _ _____ ___ ___
4
+ # | _ \ __| /_\ / __| || |__|_ _/_\ | | | |/ | \ / / | /_\ | _ ) __|___ / _ \ /_\ |_ _|__ / __| __| \| | __| _ \ /_\_ _/ _ \| _ \
5
+ # | / _| / _ \ (__| __ |___|| |/ _ \| |__| ' < \ V /| |__ / _ \| _ \__ \___| (_) / _ \ | |___| (_ | _|| .` | _|| / / _ \| || (_) | /
6
+ # |_|_\___/_/ \_\___|_||_| |_/_/ \_\____|_|\_\ |_| |____/_/ \_\___/___/ \___/_/ \_\___| \___|___|_|\_|___|_|_\/_/ \_\_| \___/|_|_\
7
+ #
8
+ # Reach Messaging API
9
+ # Reach SMS API helps you add robust messaging capabilities to your applications. Using this REST API, you can * send SMS messages * track the delivery of sent messages * schedule SMS messages to send at a later time * retrieve and modify message history
10
+ #
11
+ # NOTE: This class is auto generated by OpenAPI Generator.
12
+ # https://openapi-generator.tech
13
+ # Do not edit the class manually.
14
+ #
15
+
16
+
17
+ module Reach
18
+ module REST
19
+ class Api
20
+ class Messaging < Version
21
+ class MessagingItemList < ListResource
22
+ ##
23
+ # Initialize the MessagingItemList
24
+ # @param [Version] version Version that contains the resource
25
+ # @return [MessagingItemList] MessagingItemList
26
+ def initialize(version)
27
+ super(version)
28
+ # Path Solution
29
+ @solution = { }
30
+ @uri = {
31
+ "read" => "/messaging/v1/list",
32
+ "dispatch" => "/messaging/v1/create"
33
+ }
34
+
35
+ end
36
+ ##
37
+ # Dispatch the MessagingItemInstance
38
+ # @param [String] dest The destination phone number in E.164 format of the message.
39
+ # @param [String] src The phone number (in E.164 format), or the alphanumeric sender ID that initiated the message.
40
+ # @param [String] body The text of the message to send. It can be up to 1,600 GSM-7 characters in length. That limit varies if your message is not made of only GSM-7 characters. More generally, the message body should not exceed 10 segments.
41
+ # @param [String] bulk_identifier The identifier of the bulk operation this message belongs to.
42
+ # @param [Time] scheduled_time The datetime at which the message will be sent. Must be in ISO 8601 format. A message must be scheduled at least 15 min in advance of message send time and cannot be scheduled more than 5 days in advance of the request.
43
+ # @param [String] status_callback The URL that will be called to send status information of your message. If provided, the API POST these message status changes to the URL: `queued`, `failed`, `sent`, `canceled`, `delivered`, or `undelivered`. URLs must contain a valid hostname and underscores are not allowed.
44
+ # @param [Float] max_price The maximum total price in the applet currency that should be paid for the message to be delivered. If the cost exceeds `maxPrice`, the message will fail and a status of `failed` is sent to the status callback.
45
+ # @param [String] validity_period It represents how long, in seconds, the message can remain in the queue. After this period elapses, the message fails and the status callback is called. After a message has been accepted by a carrier, however, there is no guarantee that the message will not be queued after this period. It is recommended that this value be at least 5 seconds. The maximum allowed value is 14,400 which corresponds to 4 hours.
46
+ # @return [MessagingItemInstance] Dispatchd MessagingItemInstance
47
+ def dispatch(
48
+ dest: nil,
49
+ src: nil,
50
+ body: nil,
51
+ bulk_identifier: :unset,
52
+ scheduled_time: :unset,
53
+ status_callback: :unset,
54
+ max_price: :unset,
55
+ validity_period: :unset
56
+ )
57
+
58
+ baseParams = {
59
+ }
60
+ data = Reach::Values.of(baseParams.merge({
61
+ 'dest' => dest,
62
+ 'src' => src,
63
+ 'body' => body,
64
+ 'bulkIdentifier' => bulk_identifier,
65
+ 'scheduledTime' => Reach.serialize_iso8601_datetime(scheduled_time),
66
+ 'statusCallback' => status_callback,
67
+ 'maxPrice' => max_price,
68
+ 'validityPeriod' => validity_period,
69
+ }))
70
+
71
+
72
+
73
+ payload = @version.dispatch('POST', @uri["dispatch"], data: data)
74
+ MessagingItemInstance.new(
75
+ @version,
76
+ payload,
77
+ )
78
+ end
79
+
80
+
81
+ ##
82
+ # Lists MessagingItemInstance records from the API as a list.
83
+ # Unlike stream(), this operation is eager and will load `limit` records into
84
+ # memory before returning.
85
+ # @param [String] dest Retrieve messages sent to only this phone number. The phone number in E.164 format of the message.
86
+ # @param [String] src Retrieve messages sent from only this phone number, in E.164 format, or alphanumeric sender ID.
87
+ # @param [String] bulk_identifier Retrieve only messages that are assocaited with this `bulkIdentifier`.
88
+ # @param [Time] sent_at Retrieve only messages sent at the specified date. Must be in ISO 8601 format.
89
+ # @param [Time] sent_after Retrieve only messages sent after the specified datetime. Must be in ISO 8601 format.
90
+ # @param [Time] sent_before Retrieve only messages sent before the specified datetime. Must be in ISO 8601 format.
91
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
92
+ # guarantees to never return more than limit. Default is no limit
93
+ # @param [Integer] page_size Number of records to fetch per request, when
94
+ # not set will use the default value of 50 records. If no page_size is defined
95
+ # but a limit is defined, stream() will attempt to read the limit with the most
96
+ # efficient page size, i.e. min(limit, 1000)
97
+ # @return [Array] Array of up to limit results
98
+ def list(dest: :unset, src: :unset, bulk_identifier: :unset, sent_at: :unset, sent_after: :unset, sent_before: :unset, limit: nil, page_size: nil)
99
+ self.stream(
100
+ dest: dest,
101
+ src: src,
102
+ bulk_identifier: bulk_identifier,
103
+ sent_at: sent_at,
104
+ sent_after: sent_after,
105
+ sent_before: sent_before,
106
+ limit: limit,
107
+ page_size: page_size
108
+ ).entries
109
+ end
110
+
111
+ ##
112
+ # Streams Instance records from the API as an Enumerable.
113
+ # This operation lazily loads records as efficiently as possible until the limit
114
+ # is reached.
115
+ # @param [String] dest Retrieve messages sent to only this phone number. The phone number in E.164 format of the message.
116
+ # @param [String] src Retrieve messages sent from only this phone number, in E.164 format, or alphanumeric sender ID.
117
+ # @param [String] bulk_identifier Retrieve only messages that are assocaited with this `bulkIdentifier`.
118
+ # @param [Time] sent_at Retrieve only messages sent at the specified date. Must be in ISO 8601 format.
119
+ # @param [Time] sent_after Retrieve only messages sent after the specified datetime. Must be in ISO 8601 format.
120
+ # @param [Time] sent_before Retrieve only messages sent before the specified datetime. Must be in ISO 8601 format.
121
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
122
+ # guarantees to never return more than limit. Default is no limit
123
+ # @param [Integer] page_size Number of records to fetch per request, when
124
+ # not set will use the default value of 50 records. If no page_size is defined
125
+ # but a limit is defined, stream() will attempt to read the limit with the most
126
+ # efficient page size, i.e. min(limit, 1000)
127
+ # @return [Enumerable] Enumerable that will yield up to limit results
128
+ def stream(dest: :unset, src: :unset, bulk_identifier: :unset, sent_at: :unset, sent_after: :unset, sent_before: :unset, limit: nil, page_size: nil)
129
+ limits = @version.read_limits(limit, page_size)
130
+
131
+ page = self.page(
132
+ dest: dest,
133
+ src: src,
134
+ bulk_identifier: bulk_identifier,
135
+ sent_at: sent_at,
136
+ sent_after: sent_after,
137
+ sent_before: sent_before,
138
+ page_size: limits[:page_size], )
139
+
140
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
141
+ end
142
+
143
+ ##
144
+ # When passed a block, yields MessagingItemInstance records from the API.
145
+ # This operation lazily loads records as efficiently as possible until the limit
146
+ # is reached.
147
+ def each
148
+ limits = @version.read_limits
149
+
150
+ page = self.page(page_size: limits[:page_size], )
151
+
152
+ @version.stream(page,
153
+ limit: limits[:limit],
154
+ page_limit: limits[:page_limit]).each {|x| yield x}
155
+ end
156
+
157
+ ##
158
+ # Retrieve a single page of MessagingItemInstance records from the API.
159
+ # Request is executed immediately.
160
+ # @param [String] dest Retrieve messages sent to only this phone number. The phone number in E.164 format of the message.
161
+ # @param [String] src Retrieve messages sent from only this phone number, in E.164 format, or alphanumeric sender ID.
162
+ # @param [String] bulk_identifier Retrieve only messages that are assocaited with this `bulkIdentifier`.
163
+ # @param [Time] sent_at Retrieve only messages sent at the specified date. Must be in ISO 8601 format.
164
+ # @param [Time] sent_after Retrieve only messages sent after the specified datetime. Must be in ISO 8601 format.
165
+ # @param [Time] sent_before Retrieve only messages sent before the specified datetime. Must be in ISO 8601 format.
166
+ # @param [Integer] page_number Page Number, this value is simply for client state
167
+ # @param [Integer] page_size Number of records to return, defaults to 20
168
+ # @return [Page] Page of MessagingItemInstance
169
+ def page(dest: :unset, src: :unset, bulk_identifier: :unset, sent_at: :unset, sent_after: :unset, sent_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
170
+ params = Reach::Values.of({
171
+
172
+ 'dest' => dest,
173
+
174
+ 'src' => src,
175
+
176
+ 'bulkIdentifier' => bulk_identifier,
177
+
178
+ 'sentAt' => Reach.serialize_iso8601_datetime(sent_at),
179
+
180
+ 'sentAfter' => Reach.serialize_iso8601_datetime(sent_after),
181
+
182
+ 'sentBefore' => Reach.serialize_iso8601_datetime(sent_before),
183
+
184
+ 'page' => page_number,
185
+ 'pageSize' => page_size,
186
+ })
187
+
188
+ baseUrl = @version.url_without_pagination_info(@version.absolute_url(@uri["read"]), params)
189
+ response = @version.page('GET', @uri["read"], params: params)
190
+
191
+ MessagingItemPage.new(baseUrl, @version, response, @solution)
192
+ end
193
+
194
+ ##
195
+ # Retrieve a single page of MessagingItemInstance records from the API.
196
+ # Request is executed immediately.
197
+ # @param [String] target_url API-generated URL for the requested results page
198
+ # @return [Page] Page of MessagingItemInstance
199
+ def get_page(target_url)
200
+ baseUrl = @version.url_without_pagination_info(target_url)
201
+ response = @version.domain.request(
202
+ 'GET',
203
+ target_url
204
+ )
205
+ MessagingItemPage.new(baseUrl, @version, response, @solution)
206
+ end
207
+
208
+
209
+
210
+ # Provide a user friendly representation
211
+ def to_s
212
+ '#<Reach.Api.Messaging.MessagingItemList>'
213
+ end
214
+ end
215
+
216
+
217
+ class MessagingItemContext < InstanceContext
218
+ ##
219
+ # Initialize the MessagingItemContext
220
+ # @param [Version] version Version that contains the resource
221
+ # @param [String] message_id The identifier of the message to be updated.
222
+ # @return [MessagingItemContext] MessagingItemContext
223
+ def initialize(version, message_id)
224
+ super(version)
225
+
226
+ # Path Solution
227
+ @solution = { message_id: message_id, }
228
+ @uri = {
229
+ "fetch" => "/messaging/v1/fetch",
230
+ "update" => "/messaging/v1/update",
231
+ "delete" => "/messaging/v1/delete",
232
+ "unschedule" => "/messaging/v1/unschedule"
233
+ }
234
+
235
+
236
+ end
237
+ ##
238
+ # Delete the MessagingItemInstance
239
+ # @return [Boolean] True if delete succeeds, false otherwise
240
+ def delete(
241
+ )
242
+
243
+ baseParams = {
244
+ 'messageId' => @solution[:message_id],
245
+ }
246
+
247
+ params = Reach::Values.of(baseParams)
248
+
249
+ @version.delete('DELETE', @uri["delete"], data: params)
250
+ end
251
+
252
+ ##
253
+ # Fetch the MessagingItemInstance
254
+ # @return [MessagingItemInstance] Fetched MessagingItemInstance
255
+ def fetch(
256
+ )
257
+
258
+ baseParams = {
259
+ 'messageId' => @solution[:message_id],
260
+ }
261
+
262
+ params = Reach::Values.of(baseParams)
263
+
264
+ payload = @version.fetch('GET', @uri["fetch"], params: params)
265
+ MessagingItemInstance.new(
266
+ @version,
267
+ payload,
268
+ message_id: @solution[:message_id],
269
+ )
270
+ end
271
+
272
+ ##
273
+ # Unschedule the MessagingItemInstance
274
+ # @return [MessagingItemInstance] Unscheduled MessagingItemInstance
275
+ def unschedule(
276
+ )
277
+
278
+ baseParams = {
279
+ 'messageId' => @solution[:message_id],
280
+ }
281
+
282
+ params = Reach::Values.of(baseParams)
283
+
284
+ payload = @version.unschedule('POST', @uri["unschedule"], data: params)
285
+ MessagingItemInstance.new(
286
+ @version,
287
+ payload,
288
+ message_id: @solution[:message_id],
289
+ )
290
+ end
291
+
292
+ ##
293
+ # Update the MessagingItemInstance
294
+ # @param [String] body The text to be newly associated with the message.
295
+ # @return [MessagingItemInstance] Updated MessagingItemInstance
296
+ def update(
297
+ body: nil
298
+ )
299
+
300
+ baseParams = {
301
+ 'messageId' => @solution[:message_id],
302
+ }
303
+ data = Reach::Values.of(baseParams.merge({
304
+ 'body' => body,
305
+ }))
306
+
307
+
308
+
309
+ payload = @version.update('POST', @uri["update"], data: data)
310
+ MessagingItemInstance.new(
311
+ @version,
312
+ payload,
313
+ message_id: @solution[:message_id],
314
+ )
315
+ end
316
+
317
+
318
+ ##
319
+ # Provide a user friendly representation
320
+ def to_s
321
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
322
+ "#<Reach.Api.Messaging.MessagingItemContext #{context}>"
323
+ end
324
+
325
+ ##
326
+ # Provide a detailed, user friendly representation
327
+ def inspect
328
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
329
+ "#<Reach.Api.Messaging.MessagingItemContext #{context}>"
330
+ end
331
+ end
332
+
333
+ class MessagingItemPage < Page
334
+ ##
335
+ # Initialize the MessagingItemPage
336
+ # @param [String] baseUrl url without pagination info
337
+ # @param [Version] version Version that contains the resource
338
+ # @param [Response] response Response from the API
339
+ # @param [Hash] solution Path solution for the resource
340
+ # @return [MessagingItemPage] MessagingItemPage
341
+ def initialize(baseUrl, version, response, solution)
342
+ super(baseUrl, version, response)
343
+
344
+ # Path Solution
345
+ @solution = solution
346
+ end
347
+
348
+ ##
349
+ # Build an instance of MessagingItemInstance
350
+ # @param [Hash] payload Payload response from the API
351
+ # @return [MessagingItemInstance] MessagingItemInstance
352
+ def get_instance(payload)
353
+ MessagingItemInstance.new(@version, payload)
354
+ end
355
+
356
+ ##
357
+ # Provide a user friendly representation
358
+ def to_s
359
+ '<Reach.Api.Messaging.MessagingItemPage>'
360
+ end
361
+ end
362
+ class MessagingItemInstance < InstanceResource
363
+ ##
364
+ # Initialize the MessagingItemInstance
365
+ # @param [Version] version Version that contains the resource
366
+ # @param [Hash] payload payload that contains response from Reach(TalkyLabs)
367
+ # @param [String] account_sid The SID of the
368
+ # Account that created this MessagingItem
369
+ # resource.
370
+ # @param [String] sid The SID of the Call resource to fetch.
371
+ # @return [MessagingItemInstance] MessagingItemInstance
372
+ def initialize(version, payload , message_id: nil)
373
+ super(version)
374
+
375
+ # Marshaled Properties
376
+ @properties = {
377
+ 'appletId' => payload['appletId'],
378
+ 'apiVersion' => payload['apiVersion'],
379
+ 'body' => payload['body'],
380
+ 'dest' => payload['dest'],
381
+ 'src' => payload['src'],
382
+ 'bulkId' => payload['bulkId'],
383
+ 'numSegments' => payload['numSegments'] == nil ? payload['numSegments'] : payload['numSegments'].to_i,
384
+ 'numMedia' => payload['numMedia'] == nil ? payload['numMedia'] : payload['numMedia'].to_i,
385
+ 'price' => payload['price'],
386
+ 'priceUnit' => payload['priceUnit'],
387
+ 'messageId' => payload['messageId'],
388
+ 'status' => payload['status'],
389
+ 'messageType' => payload['messageType'],
390
+ 'errorCode' => payload['errorCode'] == nil ? payload['errorCode'] : payload['errorCode'].to_i,
391
+ 'errorMessage' => payload['errorMessage'],
392
+ 'dateCreated' => Reach.deserialize_iso8601_datetime(payload['dateCreated']),
393
+ 'dateSent' => Reach.deserialize_iso8601_datetime(payload['dateSent']),
394
+ 'dateUpdated' => Reach.deserialize_iso8601_datetime(payload['dateUpdated']),
395
+ }
396
+
397
+ # Context
398
+ @instance_context = nil
399
+ @params = { 'message_id' => message_id || @properties['messageId'] , }
400
+ end
401
+
402
+ ##
403
+ # Generate an instance context for the instance, the context is capable of
404
+ # performing various actions. All instance actions are proxied to the context
405
+ # @return [MessagingItemContext] CallContext for this CallInstance
406
+ def context
407
+ unless @instance_context
408
+ @instance_context = MessagingItemContext.new(@version , @params['message_id'])
409
+ end
410
+ @instance_context
411
+ end
412
+
413
+ ##
414
+ # @return [String] The identifier of the applet sending the message.
415
+ def appletId
416
+ @properties['appletId']
417
+ end
418
+
419
+ ##
420
+ # @return [String] The API version used to process the message.
421
+ def apiVersion
422
+ @properties['apiVersion']
423
+ end
424
+
425
+ ##
426
+ # @return [String] The message text.
427
+ def body
428
+ @properties['body']
429
+ end
430
+
431
+ ##
432
+ # @return [String] The phone number in E.164 format that received the message.
433
+ def dest
434
+ @properties['dest']
435
+ end
436
+
437
+ ##
438
+ # @return [String] The phone number (in E.164 format), or the alphanumeric sender ID that initiated the message.
439
+ def src
440
+ @properties['src']
441
+ end
442
+
443
+ ##
444
+ # @return [String] The bulk identifier allowing to group messages together and have corresponding statistics.
445
+ def bulkId
446
+ @properties['bulkId']
447
+ end
448
+
449
+ ##
450
+ # @return [String] The number of segments associated to the message. A message body that is too large to be sent in a single SMS is segmented and charged as multiple messages. The segments are reassembled once received by the destination phone. A message can have a maximum of 10 segments.
451
+ def numSegments
452
+ @properties['numSegments']
453
+ end
454
+
455
+ ##
456
+ # @return [String] The number of media files included in the message
457
+ def numMedia
458
+ @properties['numMedia']
459
+ end
460
+
461
+ ##
462
+ # @return [Float] The cost billed for the message, in the currency specified by `priceUnit`.
463
+ def price
464
+ @properties['price']
465
+ end
466
+
467
+ ##
468
+ # @return [String] The currency, in ISO 4127 format, in which price is measured. for example, usd, xaf, eur, cad.
469
+ def priceUnit
470
+ @properties['priceUnit']
471
+ end
472
+
473
+ ##
474
+ # @return [String] The identifier of the message
475
+ def messageId
476
+ @properties['messageId']
477
+ end
478
+
479
+ ##
480
+ # @return [String] The status of the message. Can be: `sent`, `scheduled`, `failed`, `delivered`, `undelivered`, `canceled`, `accepted`, `queued`, `sending`, `received`, `receiving`.
481
+ def status
482
+ @properties['status']
483
+ end
484
+
485
+ ##
486
+ # @return [String] The type of the message. Can be: `inbound` for incoming messages, `outbound` for messages initiated by a REST API.
487
+ def messageType
488
+ @properties['messageType']
489
+ end
490
+
491
+ ##
492
+ # @return [String] The error code returned if the message status is `failed` or `undelivered`. The errorMessage provides more information about the failure. The value is null if the message is successful.
493
+ def errorCode
494
+ @properties['errorCode']
495
+ end
496
+
497
+ ##
498
+ # @return [String] The error message returned if the message status is `failed` or `undelivered`. The value is null if the message is successful.
499
+ def errorMessage
500
+ @properties['errorMessage']
501
+ end
502
+
503
+ ##
504
+ # @return [Time] The date and time in GMT that the message was created.
505
+ def dateCreated
506
+ @properties['dateCreated']
507
+ end
508
+
509
+ ##
510
+ # @return [Time] The date and time in GMT that the message was sent.
511
+ def dateSent
512
+ @properties['dateSent']
513
+ end
514
+
515
+ ##
516
+ # @return [Time] The date and time in GMT that the message status was last updated.
517
+ def dateUpdated
518
+ @properties['dateUpdated']
519
+ end
520
+
521
+ ##
522
+ # Delete the MessagingItemInstance
523
+ # @return [Boolean] True if delete succeeds, false otherwise
524
+ def delete(
525
+ )
526
+
527
+ context.delete(
528
+ )
529
+ end
530
+
531
+ ##
532
+ # Fetch the MessagingItemInstance
533
+ # @return [MessagingItemInstance] Fetched MessagingItemInstance
534
+ def fetch(
535
+ )
536
+
537
+ context.fetch(
538
+ )
539
+ end
540
+
541
+ ##
542
+ # Unschedule the MessagingItemInstance
543
+ # @return [MessagingItemInstance] Unscheduled MessagingItemInstance
544
+ def unschedule(
545
+ )
546
+
547
+ context.unschedule(
548
+ )
549
+ end
550
+
551
+ ##
552
+ # Update the MessagingItemInstance
553
+ # @param [String] body The text to be newly associated with the message.
554
+ # @return [MessagingItemInstance] Updated MessagingItemInstance
555
+ def update(
556
+ body: nil
557
+ )
558
+
559
+ context.update(
560
+ body: body,
561
+ )
562
+ end
563
+
564
+ ##
565
+ # Provide a user friendly representation
566
+ def to_s
567
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
568
+ "<Reach.Api.Messaging.MessagingItemInstance #{values}>"
569
+ end
570
+
571
+ ##
572
+ # Provide a detailed, user friendly representation
573
+ def inspect
574
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
575
+ "<Reach.Api.Messaging.MessagingItemInstance #{values}>"
576
+ end
577
+ end
578
+
579
+ end
580
+ end
581
+ end
582
+ end
@@ -0,0 +1,51 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ ___ _ ___ _ _ _____ _ _ _ ___ ___ _ ___ ___ ___ _ ___ ___ ___ _ _ ___ ___ _ _____ ___ ___
4
+ # | _ \ __| /_\ / __| || |__|_ _/_\ | | | |/ | \ / / | /_\ | _ ) __|___ / _ \ /_\ |_ _|__ / __| __| \| | __| _ \ /_\_ _/ _ \| _ \
5
+ # | / _| / _ \ (__| __ |___|| |/ _ \| |__| ' < \ V /| |__ / _ \| _ \__ \___| (_) / _ \ | |___| (_ | _|| .` | _|| / / _ \| || (_) | /
6
+ # |_|_\___/_/ \_\___|_||_| |_/_/ \_\____|_|\_\ |_| |____/_/ \_\___/___/ \___/_/ \_\___| \___|___|_|\_|___|_|_\/_/ \_\_| \___/|_|_\
7
+ #
8
+ # Reach Messaging API
9
+ # Reach SMS API helps you add robust messaging capabilities to your applications. Using this REST API, you can * send SMS messages * track the delivery of sent messages * schedule SMS messages to send at a later time * retrieve and modify message history
10
+ #
11
+ # NOTE: This class is auto generated by OpenAPI Generator.
12
+ # https://openapi-generator.tech
13
+ # Do not edit the class manually.
14
+ #
15
+
16
+ module Reach
17
+ module REST
18
+ class Api
19
+ class Messaging < Version
20
+ ##
21
+ # Initialize the Messaging version of Api
22
+ def initialize(domain)
23
+ super
24
+ @version = 'rest'
25
+ @messaging_items = nil
26
+ end
27
+
28
+
29
+ ##
30
+ # @param [String] message_id
31
+ # @return [Reach::REST::Api::Messaging::MessagingItemContext] if messageId was passed.
32
+ # @return [Reach::REST::Api::Messaging::MessagingItemList]
33
+ def messaging_items(message_id=:unset)
34
+ if message_id.nil?
35
+ raise ArgumentError, 'message_id cannot be nil'
36
+ end
37
+ if message_id == :unset
38
+ @messaging_items ||= MessagingItemList.new self
39
+ else
40
+ MessagingItemContext.new(self, message_id)
41
+ end
42
+ end
43
+ ##
44
+ # Provide a user friendly representation
45
+ def to_s
46
+ '<Reach::REST::Api::Messaging>';
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end