Class: Verizon::DeviceSMSMessagingController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::DeviceSMSMessagingController
- Defined in:
- lib/verizon/controllers/device_sms_messaging_controller.rb
Overview
DeviceSMSMessagingController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#get_sms_messages(account_name, mnext: nil) ⇒ ApiResponse
Retrieves queued SMS messages sent by all M2M MC devices associated with an account.
-
#list_sms_message_history(body) ⇒ ApiResponse
Returns a list of sms history for a given device during a specified time frame.
-
#send_an_sms_message(body) ⇒ ApiResponse
Sends an SMS message to one device.
-
#start_sms_message_delivery(account_name) ⇒ ApiResponse
Starts delivery of SMS messages for the specified account.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from Verizon::BaseController
Instance Method Details
#get_sms_messages(account_name, mnext: nil) ⇒ ApiResponse
Retrieves queued SMS messages sent by all M2M MC devices associated with an account. the pageUrl in Location Header
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/verizon/controllers/device_sms_messaging_controller.rb', line 41 def (account_name, mnext: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/m2m/v1/sms/{accountName}/history', Server::THINGSPACE) .template_param(new_parameter(account_name, key: 'accountName') .should_encode(true)) .query_param(new_parameter(mnext, key: 'next')) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SmsMessagesResponse.method(:from_hash)) .is_api_response(true) .local_error('default', 'Error response', GIORestErrorResponseException)) .execute end |
#list_sms_message_history(body) ⇒ ApiResponse
Returns a list of sms history for a given device during a specified time frame.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/verizon/controllers/device_sms_messaging_controller.rb', line 88 def (body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/m2m/v1/devices/sms/history/actions/list', Server::THINGSPACE) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GIORequestResponse.method(:from_hash)) .is_api_response(true) .local_error('default', 'Error response', GIORestErrorResponseException)) .execute end |
#send_an_sms_message(body) ⇒ ApiResponse
Sends an SMS message to one device. Messages are queued on the M2M MC Platform and sent as soon as possible, but they may be delayed due to traffic and routing considerations. indiividual device.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/verizon/controllers/device_sms_messaging_controller.rb', line 15 def (body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/m2m/v1/sms', Server::THINGSPACE) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GIORequestResponse.method(:from_hash)) .is_api_response(true) .local_error('default', 'Error response', GIORestErrorResponseException)) .execute end |
#start_sms_message_delivery(account_name) ⇒ ApiResponse
Starts delivery of SMS messages for the specified account.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/verizon/controllers/device_sms_messaging_controller.rb', line 65 def (account_name) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/m2m/v1/sms/{accountName}/startCallbacks', Server::THINGSPACE) .template_param(new_parameter(account_name, key: 'accountName') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SuccessResponse.method(:from_hash)) .is_api_response(true) .local_error('default', 'Error response', GIORestErrorResponseException)) .execute end |