class Telstra_Messaging::MessagingApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/Telstra_Messaging/api/messaging_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

get_mms_status(messageid, opts = {}) click to toggle source

Get MMS Status Get MMS Status @param messageid Unique identifier of a message - it is the value returned from a previous POST call to api.telstra.com/v2/messages/mms @param [Hash] opts the optional parameters @return [Array<OutboundPollResponse>]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 27
def get_mms_status(messageid, opts = {})
  data, _status_code, _headers = get_mms_status_with_http_info(messageid, opts)
  data
end
get_mms_status_with_http_info(messageid, opts = {}) click to toggle source

Get MMS Status Get MMS Status @param messageid Unique identifier of a message - it is the value returned from a previous POST call to api.telstra.com/v2/messages/mms @param [Hash] opts the optional parameters @return [Array<(Array<OutboundPollResponse>, Fixnum, Hash)>] Array<OutboundPollResponse> data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 37
def get_mms_status_with_http_info(messageid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_mms_status ...'
  end
  # verify the required parameter 'messageid' is set
  if @api_client.config.client_side_validation && messageid.nil?
    fail ArgumentError, "Missing the required parameter 'messageid' when calling MessagingApi.get_mms_status"
  end
  # resource path
  local_var_path = '/messages/mms/{messageid}/status'.sub('{' + 'messageid' + '}', messageid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<OutboundPollResponse>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#get_mms_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_sms_status(message_id, opts = {}) click to toggle source

Get SMS Status If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL — When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class="language-sh">{ to: '+61418123456' sentTimestamp: '2017-03-17T10:05:22+10:00' receivedTimestamp: '2017-03-17T10:05:23+10:00' messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456 deliveryStatus: DELIVRD } </code></pre> The fields are: <table> <thead> <tr> <th>Field</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>to</td> <td>The number the message was sent to.</td> </tr> <tr> <td>receivedTimestamp</td> <td>Time the message was sent to the API.</td> </tr> <tr> <td>sentTimestamp</td> <td>Time handling of the message ended.</td> </tr> <tr> <td>deliveryStatus</td> <td>The final state of the message.</td> </tr> <tr> <td>messageId</td> <td>The same reference that was returned when the original message was sent.</td> </tr> <tr> <td>receivedTimestamp</td> <td>Time the message was sent to the API.</td> </tr> </tbody> </table> Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. @param message_id Unique identifier of a message - it is the value returned from a previous POST call to api.telstra.com/v2/messages/sms. @param [Hash] opts the optional parameters @return [Array<OutboundPollResponse>]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 79
def get_sms_status(message_id, opts = {})
  data, _status_code, _headers = get_sms_status_with_http_info(message_id, opts)
  data
end
get_sms_status_with_http_info(message_id, opts = {}) click to toggle source

Get SMS Status If no notification URL has been specified, it is possible to poll for the message status. Note that the &#x60;MessageId&#x60; that appears in the URL must be URL encoded. Just copying the &#x60;MessageId&#x60; as it was supplied when submitting the message may not work. SMS Status with Notification URL — When a message has reached its final state, the API will send a POST to the URL that has been previously specified. &lt;pre&gt;&lt;code class&#x3D;&quot;language-sh&quot;&gt;{ to: &#39;+61418123456&#39; sentTimestamp: &#39;2017-03-17T10:05:22+10:00&#39; receivedTimestamp: &#39;2017-03-17T10:05:23+10:00&#39; messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456 deliveryStatus: DELIVRD } &lt;/code&gt;&lt;/pre&gt; The fields are: &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Field&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;to&lt;/code&gt;&lt;/td&gt; &lt;td&gt;The number the message was sent to.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;receivedTimestamp&lt;/code&gt;&lt;/td&gt; &lt;td&gt;Time the message was sent to the API.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;sentTimestamp&lt;/code&gt;&lt;/td&gt; &lt;td&gt;Time handling of the message ended.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;deliveryStatus&lt;/code&gt;&lt;/td&gt; &lt;td&gt;The final state of the message.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;messageId&lt;/code&gt;&lt;/td&gt; &lt;td&gt;The same reference that was returned when the original message was sent.&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;receivedTimestamp&lt;/code&gt;&lt;/td&gt; &lt;td&gt;Time the message was sent to the API.&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. @param message_id Unique identifier of a message - it is the value returned from a previous POST call to api.telstra.com/v2/messages/sms. @param [Hash] opts the optional parameters @return [Array<(Array<OutboundPollResponse>, Fixnum, Hash)>] Array<OutboundPollResponse> data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 89
def get_sms_status_with_http_info(message_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.get_sms_status ...'
  end
  # verify the required parameter 'message_id' is set
  if @api_client.config.client_side_validation && message_id.nil?
    fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagingApi.get_sms_status"
  end
  # resource path
  local_var_path = '/messages/sms/{messageId}/status'.sub('{' + 'messageId' + '}', message_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<OutboundPollResponse>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#get_sms_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
retrieve_mms_responses(opts = {}) click to toggle source

Retrieve MMS Responses Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies <pre><code class="language-sh">{ "status": "RECEIVED", "destinationAddress": "+61418123456", "senderAddress": "+61421987654", "subject": "Foo", "sentTimestamp": "2018-03-23T12:15:45+10:00", "envelope": "string", "MMSContent": [ { "type": "text/plain", "filename": "text_1.txt", "payload": "string" }, { "type": "image/jpeg", "filename": "sample.jpeg", "payload": "string" } ] }</code></pre> The fields are: | Field | Description | | — | — | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | @param [Hash] opts the optional parameters @return [Array<MMSContent>]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 130
def retrieve_mms_responses(opts = {})
  data, _status_code, _headers = retrieve_mms_responses_with_http_info(opts)
  data
end
retrieve_mms_responses_with_http_info(opts = {}) click to toggle source

Retrieve MMS Responses Messages are retrieved one at a time, starting with the earliest response. If the subscription has a &#x60;notifyURL&#x60;, response messages will be logged there instead. # Notification URL Format for MMS Replies &lt;pre&gt;&lt;code class&#x3D;&quot;language-sh&quot;&gt;{ "status&quot;: "RECEIVED&quot;, "destinationAddress&quot;: "+61418123456&quot;, "senderAddress&quot;: "+61421987654&quot;, "subject&quot;: "Foo&quot;, "sentTimestamp&quot;: "2018-03-23T12:15:45+10:00&quot;, "envelope&quot;: "string&quot;, "MMSContent&quot;: [ { "type&quot;: "text/plain&quot;, "filename&quot;: "text_1.txt&quot;, "payload&quot;: "string&quot; }, { "type&quot;: "image/jpeg&quot;, "filename&quot;: "sample.jpeg&quot;, "payload&quot;: "string&quot; } ] }&lt;/code&gt;&lt;/pre&gt; The fields are: | Field | Description | | — | — | | &#x60;status&#x60; | The final state of the message. | | &#x60;destinationAddress&#x60; |The number the message was sent to. | | &#x60;senderAddress&#x60; | The number the message was sent from. | | &#x60;subject&#x60; | The subject assigned to the message. | | &#x60;sentTimestamp&#x60; | Time handling of the message ended. | | &#x60;envelope&#x60; | Information about about terminal type and originating operator. | | &#x60;MMSContent&#x60; | An array of the actual content of the reply message. | | &#x60;type&#x60; | The content type of the message. | | &#x60;filename&#x60; | The filename for the message content. | | &#x60;payload&#x60; | The content of the message. | @param [Hash] opts the optional parameters @return [Array<(Array<MMSContent>, Fixnum, Hash)>] Array<MMSContent> data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 139
def retrieve_mms_responses_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_mms_responses ...'
  end
  # resource path
  local_var_path = '/messages/mms'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<MMSContent>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#retrieve_mms_responses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
retrieve_sms_responses(opts = {}) click to toggle source

Retrieve SMS Responses Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response <pre><code class="language-sh">{ "to":"+61472880123", "from":"+61412345678", "body":"Foo4", "sentTimestamp":"2018-04-20T14:24:35", "messageId":"DMASApiA0000000146" }</code></pre> The fields are: | Field | Description | | — |— | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | @param [Hash] opts the optional parameters @return [InboundPollResponse]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 176
def retrieve_sms_responses(opts = {})
  data, _status_code, _headers = retrieve_sms_responses_with_http_info(opts)
  data
end
retrieve_sms_responses_with_http_info(opts = {}) click to toggle source

Retrieve SMS Responses Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a &#x60;notifyURL&#x60;, response messages will be logged there instead. # Notification URL Format for SMS Response &lt;pre&gt;&lt;code class&#x3D;&quot;language-sh&quot;&gt;{ "to&quot;:&quot;+61472880123&quot;, "from&quot;:&quot;+61412345678&quot;, "body&quot;:&quot;Foo4&quot;, "sentTimestamp&quot;:&quot;2018-04-20T14:24:35&quot;, "messageId&quot;:&quot;DMASApiA0000000146&quot; }&lt;/code&gt;&lt;/pre&gt; The fields are: | Field | Description | | — |— | | &#x60;to&#x60; | The number the message was sent to. | | &#x60;from&#x60; | The number the message was sent from. | | &#x60;body&#x60; | The content of the SMS response. | | &#x60;sentTimestamp&#x60; | Time handling of the message ended. | | &#x60;messageId&#x60; | The ID assigned to the message. | @param [Hash] opts the optional parameters @return [Array<(InboundPollResponse, Fixnum, Hash)>] InboundPollResponse data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 185
def retrieve_sms_responses_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_sms_responses ...'
  end
  # resource path
  local_var_path = '/messages/sms'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InboundPollResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#retrieve_sms_responses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
send_mms(send_mms_request, opts = {}) click to toggle source

@param [Hash] opts the optional parameters @return [MessageSentResponse]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 224
def send_mms(send_mms_request, opts = {})
  data, _status_code, _headers = send_mms_with_http_info(send_mms_request, opts)
  data
end
send_mms_with_http_info(send_mms_request, opts = {}) click to toggle source

@param [Hash] opts the optional parameters @return [Array<(MessageSentResponse, Fixnum, Hash)>] MessageSentResponse data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 235
def send_mms_with_http_info(send_mms_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.send_mms ...'
  end
  # verify the required parameter 'send_mms_request' is set
  if @api_client.config.client_side_validation && send_mms_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_mms_request' when calling MessagingApi.send_mms"
  end
  # resource path
  local_var_path = '/messages/mms'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(send_mms_request)
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MessageSentResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#send_mms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
send_sms(send_sms_request, opts = {}) click to toggle source

@param [Hash] opts the optional parameters @return [MessageSentResponse]

# File lib/Telstra_Messaging/api/messaging_api.rb, line 280
def send_sms(send_sms_request, opts = {})
  data, _status_code, _headers = send_sms_with_http_info(send_sms_request, opts)
  data
end
send_sms_with_http_info(send_sms_request, opts = {}) click to toggle source

@param [Hash] opts the optional parameters @return [Array<(MessageSentResponse, Fixnum, Hash)>] MessageSentResponse data, response status code and response headers

# File lib/Telstra_Messaging/api/messaging_api.rb, line 291
def send_sms_with_http_info(send_sms_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MessagingApi.send_sms ...'
  end
  # verify the required parameter 'send_sms_request' is set
  if @api_client.config.client_side_validation && send_sms_request.nil?
    fail ArgumentError, "Missing the required parameter 'send_sms_request' when calling MessagingApi.send_sms"
  end
  # resource path
  local_var_path = '/messages/sms'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(send_sms_request)
  auth_names = ['auth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'MessageSentResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MessagingApi#send_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end