messagemedia_messages_sdk 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 (37) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +608 -0
  4. data/lib/message_media_messages.rb +50 -0
  5. data/lib/message_media_messages/api_helper.rb +209 -0
  6. data/lib/message_media_messages/configuration.rb +29 -0
  7. data/lib/message_media_messages/controllers/base_controller.rb +57 -0
  8. data/lib/message_media_messages/controllers/delivery_reports_controller.rb +208 -0
  9. data/lib/message_media_messages/controllers/messages_controller.rb +336 -0
  10. data/lib/message_media_messages/controllers/replies_controller.rb +208 -0
  11. data/lib/message_media_messages/exceptions/api_exception.rb +18 -0
  12. data/lib/message_media_messages/http/auth/basic_auth.rb +20 -0
  13. data/lib/message_media_messages/http/faraday_client.rb +55 -0
  14. data/lib/message_media_messages/http/http_call_back.rb +22 -0
  15. data/lib/message_media_messages/http/http_client.rb +92 -0
  16. data/lib/message_media_messages/http/http_context.rb +18 -0
  17. data/lib/message_media_messages/http/http_method_enum.rb +11 -0
  18. data/lib/message_media_messages/http/http_request.rb +48 -0
  19. data/lib/message_media_messages/http/http_response.rb +21 -0
  20. data/lib/message_media_messages/message_media_messages_client.rb +39 -0
  21. data/lib/message_media_messages/models/base_model.rb +34 -0
  22. data/lib/message_media_messages/models/cancel_scheduled_message_request.rb +35 -0
  23. data/lib/message_media_messages/models/check_delivery_reports_response.rb +35 -0
  24. data/lib/message_media_messages/models/check_replies_response.rb +35 -0
  25. data/lib/message_media_messages/models/confirm_delivery_reports_as_received_request.rb +35 -0
  26. data/lib/message_media_messages/models/confirm_delivery_reports_as_received_request_11.rb +35 -0
  27. data/lib/message_media_messages/models/confirm_replies_as_received_request.rb +35 -0
  28. data/lib/message_media_messages/models/confirm_replies_as_received_request_8.rb +35 -0
  29. data/lib/message_media_messages/models/send_messages_request.rb +35 -0
  30. data/lib/message_media_messages/models/send_messages_response.rb +35 -0
  31. data/test/controllers/controller_test_base.rb +30 -0
  32. data/test/controllers/test_delivery_reports_controller.rb +131 -0
  33. data/test/controllers/test_messages_controller.rb +105 -0
  34. data/test/controllers/test_replies_controller.rb +132 -0
  35. data/test/http_response_catcher.rb +16 -0
  36. data/test/test_helper.rb +91 -0
  37. metadata +168 -0
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # CheckRepliesResponse Model.
6
+ class CheckRepliesResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of Object]
9
+ attr_accessor :replies
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['replies'] = 'replies'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(replies = nil)
21
+ @replies = replies
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ replies = hash['replies']
30
+
31
+ # Create object from extracted values.
32
+ CheckRepliesResponse.new(replies)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # ConfirmDeliveryReportsAsReceivedRequest Model.
6
+ class ConfirmDeliveryReportsAsReceivedRequest < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of String]
9
+ attr_accessor :delivery_report_ids
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['delivery_report_ids'] = 'delivery_report_ids'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(delivery_report_ids = nil)
21
+ @delivery_report_ids = delivery_report_ids
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ delivery_report_ids = hash['delivery_report_ids']
30
+
31
+ # Create object from extracted values.
32
+ ConfirmDeliveryReportsAsReceivedRequest.new(delivery_report_ids)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # ConfirmDeliveryReportsAsReceivedRequest11 Model.
6
+ class ConfirmDeliveryReportsAsReceivedRequest11 < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of UUID | String]
9
+ attr_accessor :delivery_report_ids
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['delivery_report_ids'] = 'delivery_report_ids'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(delivery_report_ids = nil)
21
+ @delivery_report_ids = delivery_report_ids
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ delivery_report_ids = hash['delivery_report_ids']
30
+
31
+ # Create object from extracted values.
32
+ ConfirmDeliveryReportsAsReceivedRequest11.new(delivery_report_ids)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # ConfirmRepliesAsReceivedRequest Model.
6
+ class ConfirmRepliesAsReceivedRequest < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of String]
9
+ attr_accessor :reply_ids
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['reply_ids'] = 'reply_ids'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(reply_ids = nil)
21
+ @reply_ids = reply_ids
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ reply_ids = hash['reply_ids']
30
+
31
+ # Create object from extracted values.
32
+ ConfirmRepliesAsReceivedRequest.new(reply_ids)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # ConfirmRepliesAsReceivedRequest8 Model.
6
+ class ConfirmRepliesAsReceivedRequest8 < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of UUID | String]
9
+ attr_accessor :reply_ids
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['reply_ids'] = 'reply_ids'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(reply_ids = nil)
21
+ @reply_ids = reply_ids
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ reply_ids = hash['reply_ids']
30
+
31
+ # Create object from extracted values.
32
+ ConfirmRepliesAsReceivedRequest8.new(reply_ids)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # SendMessagesRequest Model.
6
+ class SendMessagesRequest < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of Object]
9
+ attr_accessor :messages
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['messages'] = 'messages'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(messages = nil)
21
+ @messages = messages
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ messages = hash['messages']
30
+
31
+ # Create object from extracted values.
32
+ SendMessagesRequest.new(messages)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MessageMediaMessages
5
+ # SendMessagesResponse Model.
6
+ class SendMessagesResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [List of Object]
9
+ attr_accessor :messages
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['messages'] = 'messages'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(messages = nil)
21
+ @messages = messages
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ messages = hash['messages']
30
+
31
+ # Create object from extracted values.
32
+ SendMessagesResponse.new(messages)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ require 'json'
4
+ require 'test/unit'
5
+ require 'message_media_messages.rb'
6
+ require_relative '../test_helper.rb'
7
+ require_relative '../http_response_catcher.rb'
8
+
9
+ class ControllerTestBase < Test::Unit::TestCase
10
+ include MessageMediaMessages
11
+
12
+ class << self
13
+ attr_accessor :controller
14
+ end
15
+
16
+ # Called only once for a test class before any test has executed.
17
+ def self.startup
18
+ @@api_client = MessageMediaMessagesClient.new
19
+ @@request_timeout = 30
20
+ @@assert_precision = 0.01
21
+
22
+
23
+ end
24
+
25
+ # Called once before every test case.
26
+ def setup
27
+ @response_catcher = HttpResponseCatcher.new
28
+ self.class.controller.http_call_back = @response_catcher
29
+ end
30
+ end
@@ -0,0 +1,131 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ require_relative 'controller_test_base'
4
+
5
+ class DeliveryReportsControllerTests < ControllerTestBase
6
+ # Called only once for the class before any test has executed
7
+ def self.startup
8
+ self.controller = @@api_client.delivery_reports
9
+ end
10
+
11
+ # Check for any delivery reports that have been received.
12
+ #Delivery reports are a notification of the change in status of a message as it is being processed.
13
+ #Each request to the check delivery reports endpoint will return any delivery reports received that
14
+ #have not yet been confirmed using the confirm delivery reports endpoint. A response from the check
15
+ #delivery reports endpoint will have the following structure:
16
+ #```json
17
+ #{
18
+ # "delivery_reports": [
19
+ # {
20
+ # "callback_url": "https://my.callback.url.com",
21
+ # "delivery_report_id": "01e1fa0a-6e27-4945-9cdb-18644b4de043",
22
+ # "source_number": "+61491570157",
23
+ # "date_received": "2017-05-20T06:30:37.642Z",
24
+ # "status": "enroute",
25
+ # "delay": 0,
26
+ # "submitted_date": "2017-05-20T06:30:37.639Z",
27
+ # "original_text": "My first message!",
28
+ # "message_id": "d781dcab-d9d8-4fb2-9e03-872f07ae94ba",
29
+ # "vendor_account_id": {
30
+ # "vendor_id": "MessageMedia",
31
+ # "account_id": "MyAccount"
32
+ # },
33
+ # "metadata": {
34
+ # "key1": "value1",
35
+ # "key2": "value2"
36
+ # }
37
+ # },
38
+ # {
39
+ # "callback_url": "https://my.callback.url.com",
40
+ # "delivery_report_id": "0edf9022-7ccc-43e6-acab-480e93e98c1b",
41
+ # "source_number": "+61491570158",
42
+ # "date_received": "2017-05-21T01:46:42.579Z",
43
+ # "status": "enroute",
44
+ # "delay": 0,
45
+ # "submitted_date": "2017-05-21T01:46:42.574Z",
46
+ # "original_text": "My second message!",
47
+ # "message_id": "fbb3b3f5-b702-4d8b-ab44-65b2ee39a281",
48
+ # "vendor_account_id": {
49
+ # "vendor_id": "MessageMedia",
50
+ # "account_id": "MyAccount"
51
+ # },
52
+ # "metadata": {
53
+ # "key1": "value1",
54
+ # "key2": "value2"
55
+ # }
56
+ # }
57
+ # ]
58
+ #}
59
+ #```
60
+ #Each delivery report will contain details about the message, including any metadata specified
61
+ #and the new status of the message (as each delivery report indicates a change in status of a
62
+ #message) and the timestamp at which the status changed. Every delivery report will have a
63
+ #unique delivery report ID for use with the confirm delivery reports endpoint.
64
+ #*Note: The source number and destination number properties in a delivery report are the inverse of
65
+ #those specified in the message that the delivery report relates to. The source number of the
66
+ #delivery report is the destination number of the original message.*
67
+ #Subsequent requests to the check delivery reports endpoint will return the same delivery reports
68
+ #and a maximum of 100 delivery reports will be returned in each request. Applications should use the
69
+ #confirm delivery reports endpoint in the following pattern so that delivery reports that have been
70
+ #processed are no longer returned in subsequent check delivery reports requests.
71
+ #1. Call check delivery reports endpoint
72
+ #2. Process each delivery report
73
+ #3. Confirm all processed delivery reports using the confirm delivery reports endpoint
74
+ #*Note: It is recommended to use the Webhooks feature to receive reply messages rather than
75
+ #polling the check delivery reports endpoint.*
76
+ def test_check_delivery_reports_1()
77
+
78
+ # Perform the API call through the SDK function
79
+ result = self.class.controller.get_check_delivery_reports()
80
+
81
+ # Test response code
82
+ assert_equal(@response_catcher.response.status_code, 200)
83
+
84
+ # Test headers
85
+ expected_headers = {}
86
+ expected_headers['content-type'] = nil
87
+
88
+ assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
89
+
90
+ # Test whether the captured response is as we expected
91
+ assert_not_nil(result)
92
+ assert_equal('{ "delivery_reports": [ { "callback_url": "https://my.callback.url.com", "delivery_report_id": "01e1fa0a-6e27-4945-9cdb-18644b4de043", "source_number": "+61491570157", "date_received": "2017-05-20T06:30:37.642Z", "status": "enroute", "delay": 0, "submitted_date": "2017-05-20T06:30:37.639Z", "original_text": "My first message!", "message_id": "d781dcab-d9d8-4fb2-9e03-872f07ae94ba", "vendor_account_id": { "vendor_id": "MessageMedia", "account_id": "MyAccount" }, "metadata": { "key1": "value1", "key2": "value2" } }, { "callback_url": "https://my.callback.url.com", "delivery_report_id": "0edf9022-7ccc-43e6-acab-480e93e98c1b", "source_number": "+61491570158", "date_received": "2017-05-21T01:46:42.579Z", "status": "enroute", "delay": 0, "submitted_date": "2017-05-21T01:46:42.574Z", "original_text": "My second message!", "message_id": "fbb3b3f5-b702-4d8b-ab44-65b2ee39a281", "vendor_account_id": { "vendor_id": "MessageMedia", "account_id": "MyAccount" }, "metadata": { "key1": "value1", "key2": "value2" } } ]}', @response_catcher.response.raw_body)
93
+ end
94
+
95
+ # Mark a delivery report as confirmed so it is no longer return in check delivery reports requests.
96
+ #The confirm delivery reports endpoint is intended to be used in conjunction with the check delivery
97
+ #reports endpoint to allow for robust processing of delivery reports. Once one or more delivery
98
+ #reports have been processed, they can then be confirmed using the confirm delivery reports endpoint so they
99
+ #are no longer returned in subsequent check delivery reports requests.
100
+ #The confirm delivery reports endpoint takes a list of delivery report IDs as follows:
101
+ #```json
102
+ #{
103
+ # "delivery_report_ids": [
104
+ # "011dcead-6988-4ad6-a1c7-6b6c68ea628d",
105
+ # "3487b3fa-6586-4979-a233-2d1b095c7718",
106
+ # "ba28e94b-c83d-4759-98e7-ff9c7edb87a1"
107
+ # ]
108
+ #}
109
+ #```
110
+ #Up to 100 delivery reports can be confirmed in a single confirm delivery reports request.
111
+ def test_confirm_delivery_reports_as_received_1()
112
+ # Parameters for the API call
113
+ body = ConfirmDeliveryReportsAsReceivedRequest.from_hash(JSON.parse(
114
+ '{"delivery_report_ids":["011dcead-6988-4ad6-a1c7-6b6c68ea628d","3487b3fa-65'\
115
+ '86-4979-a233-2d1b095c7718","ba28e94b-c83d-4759-98e7-ff9c7edb87a1"]}'
116
+ ))
117
+
118
+ # Perform the API call through the SDK function
119
+ result = self.class.controller.create_confirm_delivery_reports_as_received(body)
120
+
121
+ # Test response code
122
+ assert_equal(@response_catcher.response.status_code, 202)
123
+
124
+ # Test headers
125
+ expected_headers = {}
126
+ expected_headers['content-type'] = nil
127
+
128
+ assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
129
+ end
130
+
131
+ end
@@ -0,0 +1,105 @@
1
+ # This file was automatically generated for MessageMedia by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ require_relative 'controller_test_base'
4
+
5
+ class MessagesControllerTests < ControllerTestBase
6
+ # Called only once for the class before any test has executed
7
+ def self.startup
8
+ self.controller = @@api_client.messages
9
+ end
10
+
11
+ # Submit one or more (up to 100 per request) SMS or text to voice messages for delivery.
12
+ #The most basic message has the following structure:
13
+ #```json
14
+ #{
15
+ # "messages": [
16
+ # {
17
+ # "content": "My first message!",
18
+ # "destination_number": "+61491570156"
19
+ # }
20
+ # ]
21
+ #}
22
+ #```
23
+ #More advanced delivery features can be specified by setting the following properties in a message:
24
+ #- ```callback_url``` A URL can be included with each message to which Webhooks will be pushed to
25
+ # via a HTTP POST request. Webhooks will be sent if and when the status of the message changes as
26
+ # it is processed (if the delivery report property of the request is set to ```true```) and when replies
27
+ # are received. Specifying a callback URL is optional.
28
+ #- ```content``` The content of the message. This can be a Unicode string, up to 5,000 characters long.
29
+ # Message content is required.
30
+ #- ```delivery_report``` Delivery reports can be requested with each message. If delivery reports are requested, a webhook
31
+ # will be submitted to the ```callback_url``` property specified for the message (or to the webhooks)
32
+ # specified for the account every time the status of the message changes as it is processed. The
33
+ # current status of the message can also be retrieved via the Delivery Reports endpoint of the
34
+ # Messages API. Delivery reports are optional and by default will not be requested.
35
+ #- ```destination_number``` The destination number the message should be delivered to. This should be specified in E.164
36
+ # international format. For information on E.164, please refer to http://en.wikipedia.org/wiki/E.164.
37
+ # A destination number is required.
38
+ #- ```format``` The format specifies which format the message will be sent as, ```SMS``` (text message)
39
+ # or ```TTS``` (text to speech). With ```TTS``` format, we will call the destination number and read out the
40
+ # message using a computer generated voice. Specifying a format is optional, by default ```SMS``` will be used.
41
+ #- ```source_number``` A source number may be specified for the message, this will be the number that
42
+ # the message appears from on the handset. By default this feature is _not_ available and will be ignored
43
+ # in the request. Please contact <support@messagemeda.com> for more information. Specifying a source
44
+ # number is optional and a by default a source number will be assigned to the message.
45
+ #- ```source_number_type``` If a source number is specified, the type of source number may also be
46
+ # specified. This is recommended when using a source address type that is not an internationally
47
+ # formatted number, available options are ```INTERNATIONAL```, ```ALPHANUMERIC``` or ```SHORTCODE```. Specifying a
48
+ # source number type is only valid when the ```source_number``` parameter is specified and is optional.
49
+ # If a source number is specified and no source number type is specified, the source number type will be
50
+ # inferred from the source number, however this may be inaccurate.
51
+ #- ```scheduled``` A message can be scheduled for delivery in the future by setting the scheduled property.
52
+ # The scheduled property expects a date time specified in ISO 8601 format. The scheduled time must be
53
+ # provided in UTC and is optional. If no scheduled property is set, the message will be delivered immediately.
54
+ #- ```message_expiry_timestamp``` A message expiry timestamp can be provided to specify the latest time
55
+ # at which the message should be delivered. If the message cannot be delivered before the specified
56
+ # message expiry timestamp elapses, the message will be discarded. Specifying a message expiry
57
+ # timestamp is optional.
58
+ #- ```metadata``` Metadata can be included with the message which will then be included with any delivery
59
+ # reports or replies matched to the message. This can be used to create powerful two-way messaging
60
+ # applications without having to store persistent data in the application. Up to 10 key / value metadata data
61
+ # pairs can be specified in a message. Each key can be up to 100 characters long, and each value up to
62
+ # 256 characters long. Specifying metadata for a message is optional.
63
+ #The response body of a successful POST request to the messages endpoint will include a ```messages```
64
+ #property which contains a list of all messages submitted. The list of messages submitted will
65
+ #reflect the list of messages included in the request, but each message will also contain two new
66
+ #properties, ```message_id``` and ```status```. The returned message ID will be a 36 character UUID
67
+ #which can be used to check the status of the message via the Get Message Status endpoint. The status
68
+ #of the message which reflect the status of the message at submission time which will always be
69
+ #```queued```. See the Delivery Reports section of this documentation for more information on message
70
+ #statues.
71
+ #*Note: when sending multiple messages in a request, all messages must be valid for the request to be successful.
72
+ #If any messages in the request are invalid, no messages will be sent.*
73
+ def test_send_messages_1()
74
+ # Parameters for the API call
75
+ body = SendMessagesRequest.from_hash(JSON.parse(
76
+ '{"messages":[{"callback_url":"https://my.callback.url.com","content":"My fi'\
77
+ 'rst message","destination_number":"+61491570156","delivery_report":true,"fo'\
78
+ 'rmat":"SMS","message_expiry_timestamp":"2016-11-03T11:49:02.807Z","metadata'\
79
+ '":{"key1":"value1","key2":"value2"},"scheduled":"2016-11-03T11:49:02.807Z",'\
80
+ '"source_number":"+61491570157","source_number_type":"INTERNATIONAL"},{"call'\
81
+ 'back_url":"https://my.callback.url.com","content":"My second message","dest'\
82
+ 'ination_number":"+61491570158","delivery_report":true,"format":"SMS","messa'\
83
+ 'ge_expiry_timestamp":"2016-11-03T11:49:02.807Z","metadata":{"key1":"value1"'\
84
+ ',"key2":"value2"},"scheduled":"2016-11-03T11:49:02.807Z","source_number":"+'\
85
+ '61491570159","source_number_type":"INTERNATIONAL"}]}'
86
+ ))
87
+
88
+ # Perform the API call through the SDK function
89
+ result = self.class.controller.create_send_messages(body)
90
+
91
+ # Test response code
92
+ assert_equal(@response_catcher.response.status_code, 202)
93
+
94
+ # Test headers
95
+ expected_headers = {}
96
+ expected_headers['content-type'] = nil
97
+
98
+ assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
99
+
100
+ # Test whether the captured response is as we expected
101
+ assert_not_nil(result)
102
+ assert_equal('{ "messages": [ { "message_id": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a", "callback_url": "https://my.url.com", "status": "delivered", "content": "My first message", "destination_number": "+61491570156", "delivery_report": true, "format": "SMS", "message_expiry_timestamp": "2016-11-03T11:49:02.807Z", "metadata": { "key1": "value1", "key2": "value2" }, "scheduled": "2016-11-03T11:49:02.807Z", "source_number": "+61491570157", "source_number_type": "INTERNATIONAL" } ]}', @response_catcher.response.raw_body)
103
+ end
104
+
105
+ end