Class: Verizon::V3CampaignMetaInfo
- Defined in:
- lib/verizon/models/v3_campaign_meta_info.rb
Overview
Campaign and campaign details.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier.
-
#campaign_name ⇒ String
Campaign name.
-
#campaign_time_window_list ⇒ Array[V3TimeWindow]
List of allowed campaign time windows.
-
#end_date ⇒ Date
Campaign end date.
-
#firmware_from ⇒ String
Old firmware version.
-
#firmware_name ⇒ String
Firmware name.
-
#firmware_to ⇒ String
New software version.
-
#id ⇒ String
Campaign identifier.
-
#make ⇒ String
Device make.
-
#model ⇒ String
Device model.
-
#protocol ⇒ CampaignMetaInfoProtocol
Firmware protocol.
-
#start_date ⇒ Date
Campaign start date.
-
#status ⇒ String
Firmware upgrade status.
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:, id:, make:, model:, start_date:, end_date:, status:, campaign_name: SKIP, firmware_name: SKIP, firmware_from: SKIP, firmware_to: SKIP, protocol: CampaignMetaInfoProtocol::LW_M2M, campaign_time_window_list: SKIP, additional_properties: nil) ⇒ V3CampaignMetaInfo
constructor
A new instance of V3CampaignMetaInfo.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(account_name:, id:, make:, model:, start_date:, end_date:, status:, campaign_name: SKIP, firmware_name: SKIP, firmware_from: SKIP, firmware_to: SKIP, protocol: CampaignMetaInfoProtocol::LW_M2M, campaign_time_window_list: SKIP, additional_properties: nil) ⇒ V3CampaignMetaInfo
Returns a new instance of V3CampaignMetaInfo.
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 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 100 def initialize(account_name:, id:, make:, model:, start_date:, end_date:, status:, campaign_name: SKIP, firmware_name: SKIP, firmware_from: SKIP, firmware_to: SKIP, protocol: CampaignMetaInfoProtocol::LW_M2M, campaign_time_window_list: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_name = account_name @id = id @campaign_name = campaign_name unless campaign_name == SKIP @firmware_name = firmware_name unless firmware_name == SKIP @firmware_from = firmware_from unless firmware_from == SKIP @firmware_to = firmware_to unless firmware_to == SKIP @protocol = protocol unless protocol == SKIP @make = make @model = model @start_date = start_date @end_date = end_date unless campaign_time_window_list == SKIP @campaign_time_window_list = campaign_time_window_list end @status = status @additional_properties = additional_properties end |
Instance Attribute Details
#account_name ⇒ String
Account identifier.
14 15 16 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 14 def account_name @account_name end |
#campaign_name ⇒ String
Campaign name.
22 23 24 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 22 def campaign_name @campaign_name end |
#campaign_time_window_list ⇒ Array[V3TimeWindow]
List of allowed campaign time windows.
58 59 60 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 58 def campaign_time_window_list @campaign_time_window_list end |
#end_date ⇒ Date
Campaign end date.
54 55 56 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 54 def end_date @end_date end |
#firmware_from ⇒ String
Old firmware version.
30 31 32 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 30 def firmware_from @firmware_from end |
#firmware_name ⇒ String
Firmware name.
26 27 28 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 26 def firmware_name @firmware_name end |
#firmware_to ⇒ String
New software version.
34 35 36 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 34 def firmware_to @firmware_to end |
#id ⇒ String
Campaign identifier.
18 19 20 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 18 def id @id end |
#make ⇒ String
Device make.
42 43 44 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 42 def make @make end |
#model ⇒ String
Device model.
46 47 48 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 46 def model @model end |
#protocol ⇒ CampaignMetaInfoProtocol
Firmware protocol. Valid values include: LWM2M, OMD-DM.
38 39 40 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 38 def protocol @protocol end |
#start_date ⇒ Date
Campaign start date.
50 51 52 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 50 def start_date @start_date end |
#status ⇒ String
Firmware upgrade status.
62 63 64 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 62 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 128 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : nil id = hash.key?('id') ? hash['id'] : nil make = hash.key?('make') ? hash['make'] : nil model = hash.key?('model') ? hash['model'] : nil start_date = hash.key?('startDate') ? hash['startDate'] : nil end_date = hash.key?('endDate') ? hash['endDate'] : nil status = hash.key?('status') ? hash['status'] : nil campaign_name = hash.key?('campaignName') ? hash['campaignName'] : SKIP firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : SKIP firmware_from = hash.key?('firmwareFrom') ? hash['firmwareFrom'] : SKIP firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : SKIP protocol = hash['protocol'] ||= CampaignMetaInfoProtocol::LW_M2M # Parameter is an array, so we need to iterate through it campaign_time_window_list = nil unless hash['campaignTimeWindowList'].nil? campaign_time_window_list = [] hash['campaignTimeWindowList'].each do |structure| campaign_time_window_list << (V3TimeWindow.from_hash(structure) if structure) end end campaign_time_window_list = SKIP unless hash.key?('campaignTimeWindowList') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. V3CampaignMetaInfo.new(account_name: account_name, id: id, make: make, model: model, start_date: start_date, end_date: end_date, status: status, campaign_name: campaign_name, firmware_name: firmware_name, firmware_from: firmware_from, firmware_to: firmware_to, protocol: protocol, campaign_time_window_list: campaign_time_window_list, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['id'] = 'id' @_hash['campaign_name'] = 'campaignName' @_hash['firmware_name'] = 'firmwareName' @_hash['firmware_from'] = 'firmwareFrom' @_hash['firmware_to'] = 'firmwareTo' @_hash['protocol'] = 'protocol' @_hash['make'] = 'make' @_hash['model'] = 'model' @_hash['start_date'] = 'startDate' @_hash['end_date'] = 'endDate' @_hash['campaign_time_window_list'] = 'campaignTimeWindowList' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
96 97 98 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 96 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 84 def self.optionals %w[ campaign_name firmware_name firmware_from firmware_to protocol campaign_time_window_list ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 191 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name.inspect}, id: #{@id.inspect}, campaign_name:"\ " #{@campaign_name.inspect}, firmware_name: #{@firmware_name.inspect}, firmware_from:"\ " #{@firmware_from.inspect}, firmware_to: #{@firmware_to.inspect}, protocol:"\ " #{@protocol.inspect}, make: #{@make.inspect}, model: #{@model.inspect}, start_date:"\ " #{@start_date.inspect}, end_date: #{@end_date.inspect}, campaign_time_window_list:"\ " #{@campaign_time_window_list.inspect}, status: #{@status.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
180 181 182 183 184 185 186 187 188 |
# File 'lib/verizon/models/v3_campaign_meta_info.rb', line 180 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name}, id: #{@id}, campaign_name:"\ " #{@campaign_name}, firmware_name: #{@firmware_name}, firmware_from: #{@firmware_from},"\ " firmware_to: #{@firmware_to}, protocol: #{@protocol}, make: #{@make}, model: #{@model},"\ " start_date: #{@start_date}, end_date: #{@end_date}, campaign_time_window_list:"\ " #{@campaign_time_window_list}, status: #{@status}, additional_properties:"\ " #{@additional_properties}>" end |