Class: Verizon::SMSSendRequest
- Defined in:
- lib/verizon/models/sms_send_request.rb
Overview
Request to send SMS.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The name of a billing account.
-
#custom_fields ⇒ Array[CustomFields]
The names and values of custom fields, if you want to only include devices that have matching custom fields.
-
#data_encoding ⇒ String
The SMS message encoding, which can be 7-bit (default), 8-bit-ASCII, 8-bit-UTF-8, 8-bit-DATA.
-
#device_ids ⇒ Array[DeviceId]
The devices that you want to send the message to, specified by device identifier.
-
#group_name ⇒ String
The name of a device group, if you want to send the SMS message to all devices in the device group.
-
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
-
#sms_message ⇒ String
The contents of the SMS message.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_name = nil, sms_message = nil, custom_fields = SKIP, data_encoding = SKIP, device_ids = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ SMSSendRequest
constructor
A new instance of SMSSendRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = nil, sms_message = nil, custom_fields = SKIP, data_encoding = SKIP, device_ids = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ SMSSendRequest
Returns a new instance of SMSSendRequest.
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/verizon/models/sms_send_request.rb', line 75 def initialize(account_name = nil, = nil, custom_fields = SKIP, data_encoding = SKIP, device_ids = SKIP, group_name = SKIP, service_plan = SKIP) @account_name = account_name @sms_message = @custom_fields = custom_fields unless custom_fields == SKIP @data_encoding = data_encoding unless data_encoding == SKIP @device_ids = device_ids unless device_ids == SKIP @group_name = group_name unless group_name == SKIP @service_plan = service_plan unless service_plan == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The name of a billing account.
14 15 16 |
# File 'lib/verizon/models/sms_send_request.rb', line 14 def account_name @account_name end |
#custom_fields ⇒ Array[CustomFields]
The names and values of custom fields, if you want to only include devices that have matching custom fields.
24 25 26 |
# File 'lib/verizon/models/sms_send_request.rb', line 24 def custom_fields @custom_fields end |
#data_encoding ⇒ String
The SMS message encoding, which can be 7-bit (default), 8-bit-ASCII, 8-bit-UTF-8, 8-bit-DATA.
29 30 31 |
# File 'lib/verizon/models/sms_send_request.rb', line 29 def data_encoding @data_encoding end |
#device_ids ⇒ Array[DeviceId]
The devices that you want to send the message to, specified by device identifier.
34 35 36 |
# File 'lib/verizon/models/sms_send_request.rb', line 34 def device_ids @device_ids end |
#group_name ⇒ String
The name of a device group, if you want to send the SMS message to all devices in the device group.
39 40 41 |
# File 'lib/verizon/models/sms_send_request.rb', line 39 def group_name @group_name end |
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
44 45 46 |
# File 'lib/verizon/models/sms_send_request.rb', line 44 def service_plan @service_plan end |
#sms_message ⇒ String
The contents of the SMS message. The SMS message is limited to 160 characters in 7-bit format, or 140 characters in 8-bit format.
19 20 21 |
# File 'lib/verizon/models/sms_send_request.rb', line 19 def @sms_message end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 92 93 94 95 96 97 98 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 |
# File 'lib/verizon/models/sms_send_request.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : nil = hash.key?('smsMessage') ? hash['smsMessage'] : nil # Parameter is an array, so we need to iterate through it custom_fields = nil unless hash['customFields'].nil? custom_fields = [] hash['customFields'].each do |structure| custom_fields << (CustomFields.from_hash(structure) if structure) end end custom_fields = SKIP unless hash.key?('customFields') data_encoding = hash.key?('dataEncoding') ? hash['dataEncoding'] : SKIP # Parameter is an array, so we need to iterate through it device_ids = nil unless hash['deviceIds'].nil? device_ids = [] hash['deviceIds'].each do |structure| device_ids << (DeviceId.from_hash(structure) if structure) end end device_ids = SKIP unless hash.key?('deviceIds') group_name = hash.key?('groupName') ? hash['groupName'] : SKIP service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP # Create object from extracted values. SMSSendRequest.new(account_name, , custom_fields, data_encoding, device_ids, group_name, service_plan) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/verizon/models/sms_send_request.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['sms_message'] = 'smsMessage' @_hash['custom_fields'] = 'customFields' @_hash['data_encoding'] = 'dataEncoding' @_hash['device_ids'] = 'deviceIds' @_hash['group_name'] = 'groupName' @_hash['service_plan'] = 'servicePlan' @_hash end |
.nullables ⇒ Object
An array for nullable fields
71 72 73 |
# File 'lib/verizon/models/sms_send_request.rb', line 71 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 |
# File 'lib/verizon/models/sms_send_request.rb', line 60 def self.optionals %w[ custom_fields data_encoding device_ids group_name service_plan ] end |