Class: Verizon::GiosmsSendRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/giosms_send_request.rb

Overview

GiosmsSendRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(sms_message:, account_name: SKIP, custom_fields: SKIP, data_encoding: SKIP, group_name: SKIP, service_plan: SKIP, time_to_live: SKIP, device_ids: SKIP) ⇒ GiosmsSendRequest

Returns a new instance of GiosmsSendRequest.



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/verizon/models/giosms_send_request.rb', line 79

def initialize(sms_message:, account_name: SKIP, custom_fields: SKIP,
               data_encoding: SKIP, group_name: SKIP, service_plan: SKIP,
               time_to_live: SKIP, device_ids: SKIP)
  @account_name =  unless  == SKIP
  @custom_fields = custom_fields unless custom_fields == SKIP
  @data_encoding = data_encoding unless data_encoding == SKIP
  @group_name = group_name unless group_name == SKIP
  @service_plan = service_plan unless service_plan == SKIP
  @time_to_live = time_to_live unless time_to_live == SKIP
  @device_ids = device_ids unless device_ids == SKIP
  @sms_message = sms_message
end

Instance Attribute Details

#account_nameString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/giosms_send_request.rb', line 14

def 
  @account_name
end

#custom_fieldsArray[KvPair]

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/verizon/models/giosms_send_request.rb', line 18

def custom_fields
  @custom_fields
end

#data_encodingString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/giosms_send_request.rb', line 22

def data_encoding
  @data_encoding
end

#device_idsArray[GioDeviceId]

A period of time the message remains valid or an end date for the message. This value would be less than the 5 day default.

Returns:



40
41
42
# File 'lib/verizon/models/giosms_send_request.rb', line 40

def device_ids
  @device_ids
end

#group_nameString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/giosms_send_request.rb', line 26

def group_name
  @group_name
end

#service_planString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/giosms_send_request.rb', line 30

def service_plan
  @service_plan
end

#sms_messageString

A period of time the message remains valid or an end date for the message. This value would be less than the 5 day default.

Returns:

  • (String)


45
46
47
# File 'lib/verizon/models/giosms_send_request.rb', line 45

def sms_message
  @sms_message
end

#time_to_liveString

A period of time the message remains valid or an end date for the message. This value would be less than the 5 day default.

Returns:

  • (String)


35
36
37
# File 'lib/verizon/models/giosms_send_request.rb', line 35

def time_to_live
  @time_to_live
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
127
128
129
130
131
132
133
# File 'lib/verizon/models/giosms_send_request.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  sms_message = hash.key?('smsMessage') ? hash['smsMessage'] : nil
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  # 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 << (KvPair.from_hash(structure) if structure)
    end
  end

  custom_fields = SKIP unless hash.key?('customFields')
  data_encoding = hash.key?('dataEncoding') ? hash['dataEncoding'] : SKIP
  group_name = hash.key?('groupName') ? hash['groupName'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP
  time_to_live = hash.key?('timeToLive') ? hash['timeToLive'] : 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 << (GioDeviceId.from_hash(structure) if structure)
    end
  end

  device_ids = SKIP unless hash.key?('deviceIds')

  # Create object from extracted values.
  GiosmsSendRequest.new(sms_message: sms_message,
                        account_name: ,
                        custom_fields: custom_fields,
                        data_encoding: data_encoding,
                        group_name: group_name,
                        service_plan: service_plan,
                        time_to_live: time_to_live,
                        device_ids: device_ids)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/verizon/models/giosms_send_request.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['custom_fields'] = 'customFields'
  @_hash['data_encoding'] = 'dataEncoding'
  @_hash['group_name'] = 'groupName'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['time_to_live'] = 'timeToLive'
  @_hash['device_ids'] = 'deviceIds'
  @_hash['sms_message'] = 'smsMessage'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/verizon/models/giosms_send_request.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/verizon/models/giosms_send_request.rb', line 62

def self.optionals
  %w[
    account_name
    custom_fields
    data_encoding
    group_name
    service_plan
    time_to_live
    device_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



145
146
147
148
149
150
151
152
# File 'lib/verizon/models/giosms_send_request.rb', line 145

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, custom_fields:"\
  " #{@custom_fields.inspect}, data_encoding: #{@data_encoding.inspect}, group_name:"\
  " #{@group_name.inspect}, service_plan: #{@service_plan.inspect}, time_to_live:"\
  " #{@time_to_live.inspect}, device_ids: #{@device_ids.inspect}, sms_message:"\
  " #{@sms_message.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



136
137
138
139
140
141
142
# File 'lib/verizon/models/giosms_send_request.rb', line 136

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, custom_fields: #{@custom_fields},"\
  " data_encoding: #{@data_encoding}, group_name: #{@group_name}, service_plan:"\
  " #{@service_plan}, time_to_live: #{@time_to_live}, device_ids: #{@device_ids}, sms_message:"\
  " #{@sms_message}>"
end