Class: SibApiV3Sdk::TransactionalSMSApi

Inherits:
Object
  • Object
show all
Defined in:
lib/sib-api-v3-sdk/api/transactional_sms_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TransactionalSMSApi

Returns a new instance of TransactionalSMSApi.



19
20
21
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_sms_events(opts = {}) ⇒ GetSmsEventReport

Get all your SMS activity (unaggregated events)

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page (default to 50)

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :offset (Integer)

    Index of the first document of the page (default to 0)

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate'

  • :phone_number (String)

    Filter the report for a specific phone number

  • :event (String)

    Filter the report for specific events

  • :tags (String)

    Filter the report for specific tags passed as a serialized urlencoded array

Returns:



33
34
35
36
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 33

def get_sms_events(opts = {})
  data, _status_code, _headers = get_sms_events_with_http_info(opts)
  data
end

#get_sms_events_with_http_info(opts = {}) ⇒ Array<(GetSmsEventReport, Fixnum, Hash)>

Get all your SMS activity (unaggregated events)

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :offset (Integer)

    Index of the first document of the page

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with &#39;startDate&#39; and &#39;endDate&#39;

  • :phone_number (String)

    Filter the report for a specific phone number

  • :event (String)

    Filter the report for specific events

  • :tags (String)

    Filter the report for specific tags passed as a serialized urlencoded array

Returns:

  • (Array<(GetSmsEventReport, Fixnum, Hash)>)

    GetSmsEventReport data, response status code and response headers



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 49

def get_sms_events_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionalSMSApi.get_sms_events ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionalSMSApi.get_sms_events, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && opts[:'event'] && !['bounces', 'hardBounces', 'softBounces', 'delivered', 'sent', 'accepted', 'unsubscription', 'replies', 'blocked'].include?(opts[:'event'])
    fail ArgumentError, 'invalid value for "event", must be one of bounces, hardBounces, softBounces, delivered, sent, accepted, unsubscription, replies, blocked'
  end
  # resource path
  local_var_path = '/transactionalSMS/statistics/events'

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
  query_params[:'phoneNumber'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
  query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
  query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?

  # 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 = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetSmsEventReport')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionalSMSApi#get_sms_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transac_aggregated_sms_report(opts = {}) ⇒ GetTransacAggregatedSmsReport

Get your SMS activity aggregated over a period of time

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with startDate and endDate

  • :tag (String)

    Filter on a tag

Returns:



106
107
108
109
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 106

def get_transac_aggregated_sms_report(opts = {})
  data, _status_code, _headers = get_transac_aggregated_sms_report_with_http_info(opts)
  data
end

#get_transac_aggregated_sms_report_with_http_info(opts = {}) ⇒ Array<(GetTransacAggregatedSmsReport, Fixnum, Hash)>

Get your SMS activity aggregated over a period of time

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with startDate and endDate

  • :tag (String)

    Filter on a tag

Returns:



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 118

def get_transac_aggregated_sms_report_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionalSMSApi.get_transac_aggregated_sms_report ...'
  end
  # resource path
  local_var_path = '/transactionalSMS/statistics/aggregatedReport'

  # query parameters
  query_params = {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?

  # 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 = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetTransacAggregatedSmsReport')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionalSMSApi#get_transac_aggregated_sms_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_transac_sms_report(opts = {}) ⇒ GetTransacSmsReport

Get your SMS activity aggregated per day

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with &#39;startDate&#39; and &#39;endDate&#39;

  • :tag (String)

    Filter on a tag

Returns:



164
165
166
167
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 164

def get_transac_sms_report(opts = {})
  data, _status_code, _headers = get_transac_sms_report_with_http_info(opts)
  data
end

#get_transac_sms_report_with_http_info(opts = {}) ⇒ Array<(GetTransacSmsReport, Fixnum, Hash)>

Get your SMS activity aggregated per day

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Mandatory if endDate is used. Starting date (YYYY-MM-DD) of the report

  • :end_date (String)

    Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report

  • :days (Integer)

    Number of days in the past including today (positive integer). Not compatible with &#39;startDate&#39; and &#39;endDate&#39;

  • :tag (String)

    Filter on a tag

Returns:

  • (Array<(GetTransacSmsReport, Fixnum, Hash)>)

    GetTransacSmsReport data, response status code and response headers



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 176

def get_transac_sms_report_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionalSMSApi.get_transac_sms_report ...'
  end
  # resource path
  local_var_path = '/transactionalSMS/statistics/reports'

  # query parameters
  query_params = {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?

  # 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 = nil
  auth_names = ['api-key', 'partner-key']
  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 => 'GetTransacSmsReport')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionalSMSApi#get_transac_sms_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_transac_sms(send_transac_sms, opts = {}) ⇒ SendSms

Send SMS message to a mobile number

Parameters:

  • send_transac_sms

    Values to send a transactional SMS

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



219
220
221
222
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 219

def send_transac_sms(send_transac_sms, opts = {})
  data, _status_code, _headers = send_transac_sms_with_http_info(send_transac_sms, opts)
  data
end

#send_transac_sms_with_http_info(send_transac_sms, opts = {}) ⇒ Array<(SendSms, Fixnum, Hash)>

Send SMS message to a mobile number

Parameters:

  • send_transac_sms

    Values to send a transactional SMS

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SendSms, Fixnum, Hash)>)

    SendSms data, response status code and response headers



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/sib-api-v3-sdk/api/transactional_sms_api.rb', line 228

def send_transac_sms_with_http_info(send_transac_sms, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TransactionalSMSApi.send_transac_sms ...'
  end
  # verify the required parameter 'send_transac_sms' is set
  if @api_client.config.client_side_validation && send_transac_sms.nil?
    fail ArgumentError, "Missing the required parameter 'send_transac_sms' when calling TransactionalSMSApi.send_transac_sms"
  end
  # resource path
  local_var_path = '/transactionalSMS/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_transac_sms)
  auth_names = ['api-key', 'partner-key']
  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 => 'SendSms')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TransactionalSMSApi#send_transac_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end