Class: PhoneComClient::SmsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/phone_com_client/api/sms_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SmsApi

Returns a new instance of SmsApi.



19
20
21
# File 'lib/phone_com_client/api/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/phone_com_client/api/sms_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_account_sms(account_id, data, opts = {}) ⇒ SmsFull

Send a SMS to one or a group of recipients. Send a SMS to one or a group of recipients. For details on the input fields, see Intro to SMS. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Create SMS API with the following definition: POST api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms

Parameters:

  • account_id

    Account ID

  • data

    SMS data

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/phone_com_client/api/sms_api.rb', line 28

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

#create_account_sms_with_http_info(account_id, data, opts = {}) ⇒ Array<(SmsFull, Fixnum, Hash)>

Send a SMS to one or a group of recipients. Send a SMS to one or a group of recipients. For details on the input fields, see Intro to SMS. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Create SMS API with the following definition: POST api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms

Parameters:

  • account_id

    Account ID

  • data

    SMS data

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

    the optional parameters

Returns:

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

    SmsFull data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
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
# File 'lib/phone_com_client/api/sms_api.rb', line 39

def (, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.create_account_sms ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling SmsApi.create_account_sms"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling SmsApi.create_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms'.sub('{' + 'account_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'])
  # 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(data)
  auth_names = ['apiKey']
  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 => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#create_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_account_sms(account_id, sms_id, opts = {}) ⇒ SmsFull

This service shows the details of an individual SMS. This service shows the details of an individual SMS. See Intro to SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Get SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id

Parameters:

  • account_id

    Account ID

  • sms_id

    SMS ID

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

    the optional parameters

Returns:



88
89
90
91
# File 'lib/phone_com_client/api/sms_api.rb', line 88

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

#get_account_sms_with_http_info(account_id, sms_id, opts = {}) ⇒ Array<(SmsFull, Fixnum, Hash)>

This service shows the details of an individual SMS. This service shows the details of an individual SMS. See Intro to SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Get SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id

Parameters:

  • account_id

    Account ID

  • sms_id

    SMS ID

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

    the optional parameters

Returns:

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

    SmsFull data, response status code and response headers



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/phone_com_client/api/sms_api.rb', line 99

def (, sms_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.get_account_sms ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling SmsApi.get_account_sms"
  end
  # verify the required parameter 'sms_id' is set
  if @api_client.config.client_side_validation && sms_id.nil?
    fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsApi.get_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'sms_id' + '}', sms_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'])
  # 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 = ['apiKey']
  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 => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#get_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_account_sms(account_id, opts = {}) ⇒ ListSms

Get a list of SMS messages for an account. Get a list of SMS messages for an account. See Intro to SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :filters_id (Array<String>)

    ID filter

  • :filters_from (String)

    Caller ID filter

  • :filters_to (String)

    Callee ID filter, the E.164 phone number to send the SMS TO. Note you must encode the + as %2B

  • :filters_direction (String)

    Direction filter

  • :filters_extension (Array<String>)

    Extension filter

  • :filters_created_at (String)

    Date string representing the UTC time that sms was created

  • :sort_id (String)

    ID sorting

  • :sort_created_at (String)

    Sort by created time of message

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

Returns:



158
159
160
161
# File 'lib/phone_com_client/api/sms_api.rb', line 158

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

#list_account_sms_with_http_info(account_id, opts = {}) ⇒ Array<(ListSms, Fixnum, Hash)>

Get a list of SMS messages for an account. Get a list of SMS messages for an account. See Intro to SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level List SMS API with the following definition: GET api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms

Parameters:

  • account_id

    Account ID

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

    the optional parameters

Options Hash (opts):

  • :filters_id (Array<String>)

    ID filter

  • :filters_from (String)

    Caller ID filter

  • :filters_to (String)

    Callee ID filter, the E.164 phone number to send the SMS TO. Note you must encode the + as %2B

  • :filters_direction (String)

    Direction filter

  • :filters_extension (Array<String>)

    Extension filter

  • :filters_created_at (String)

    Date string representing the UTC time that sms was created

  • :sort_id (String)

    ID sorting

  • :sort_created_at (String)

    Sort by created time of message

  • :limit (Integer)

    Max results

  • :offset (Integer)

    Results to skip

  • :fields (String)

    Field set

Returns:

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

    ListSms data, response status code and response headers



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
215
216
217
218
219
220
221
222
223
224
225
226
227
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
# File 'lib/phone_com_client/api/sms_api.rb', line 179

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.list_account_sms ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling SmsApi.list_account_sms"
  end
  if @api_client.config.client_side_validation && !opts[:'filters_from'].nil? && opts[:'filters_from'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_from\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_to'].nil? && opts[:'filters_to'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_to\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_direction'].nil? && opts[:'filters_direction'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_direction\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'filters_created_at'].nil? && opts[:'filters_created_at'] !~ Regexp.new(/^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/)
    fail ArgumentError, "invalid value for 'opts[:\"filters_created_at\"]' when calling SmsApi.list_account_sms, must conform to the pattern /^eq:.*|^ne:.*|^lt:.*|^gt:.*|^lte:.*|^gte:.*|^starts-with:.*|^ends-with:.*|^contains:.*|^not-starts-with:.*|^not-ends-with:.*|^not-contains:.*|^between:.*,.*|^not-between:.*,.*/."
  end

  if @api_client.config.client_side_validation && !opts[:'sort_id'].nil? && opts[:'sort_id'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_id\"]' when calling SmsApi.list_account_sms, must conform to the pattern /asc|desc/."
  end

  if @api_client.config.client_side_validation && !opts[:'sort_created_at'].nil? && opts[:'sort_created_at'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_created_at\"]' when calling SmsApi.list_account_sms, must conform to the pattern /asc|desc/."
  end

  # resource path
  local_var_path = '/accounts/{account_id}/sms'.sub('{' + 'account_id' + '}', .to_s)

  # query parameters
  query_params = {}
  query_params[:'filters[id]'] = @api_client.build_collection_param(opts[:'filters_id'], :multi) if !opts[:'filters_id'].nil?
  query_params[:'filters[from]'] = opts[:'filters_from'] if !opts[:'filters_from'].nil?
  query_params[:'filters[to]'] = opts[:'filters_to'] if !opts[:'filters_to'].nil?
  query_params[:'filters[direction]'] = opts[:'filters_direction'] if !opts[:'filters_direction'].nil?
  query_params[:'filters[extension]'] = @api_client.build_collection_param(opts[:'filters_extension'], :multi) if !opts[:'filters_extension'].nil?
  query_params[:'filters[created_at]'] = opts[:'filters_created_at'] if !opts[:'filters_created_at'].nil?
  query_params[:'sort[id]'] = opts[:'sort_id'] if !opts[:'sort_id'].nil?
  query_params[:'sort[created_at]'] = opts[:'sort_created_at'] if !opts[:'sort_created_at'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].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 = ['apiKey']
  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 => 'ListSms')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#list_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_account_sms(account_id, sms_id, opts = {}) ⇒ SmsFull

Update the is_new parameter in a sms record. Update the is_new parameter in a sms record. See Account SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Patch SMS API with the following definition: PATCH api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id

Parameters:

  • account_id

    Account ID

  • sms_id

    SMS ID

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

    the optional parameters

Options Hash (opts):

Returns:



260
261
262
263
# File 'lib/phone_com_client/api/sms_api.rb', line 260

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

#patch_account_sms_with_http_info(account_id, sms_id, opts = {}) ⇒ Array<(SmsFull, Fixnum, Hash)>

Update the is_new parameter in a sms record. Update the is_new parameter in a sms record. See Account SMS for more info on the properties. Note: This API is for users with Account Owner scope access token. Users with Extension User scope token should invoke the Extension level Patch SMS API with the following definition: PATCH api.phone.com/v4/accounts/:account_id/extensions/:extension_id/sms/:sms_id

Parameters:

  • account_id

    Account ID

  • sms_id

    SMS ID

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

    the optional parameters

Options Hash (opts):

Returns:

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

    SmsFull data, response status code and response headers



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/phone_com_client/api/sms_api.rb', line 272

def (, sms_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SmsApi.patch_account_sms ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling SmsApi.patch_account_sms"
  end
  # verify the required parameter 'sms_id' is set
  if @api_client.config.client_side_validation && sms_id.nil?
    fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsApi.patch_account_sms"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/sms/{sms_id}'.sub('{' + 'account_id' + '}', .to_s).sub('{' + 'sms_id' + '}', sms_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'])
  # 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(opts[:'data'])
  auth_names = ['apiKey']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'SmsFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SmsApi#patch_account_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end