Class: Verizon::CampaignFirmwareUpgrade
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::CampaignFirmwareUpgrade
- Defined in:
- lib/verizon/models/campaign_firmware_upgrade.rb
Overview
Firmware upgrade for devices.
Instance Attribute Summary collapse
-
#auto_add_devices_flag ⇒ TrueClass | FalseClass
this flag, when set to true, will automatically add a device of the same make and model to a campaign.
-
#auto_assign_license_flag ⇒ TrueClass | FalseClass
This flag, when set to true, will assign a FOTA license automatically if the device does not have one already.
-
#campaign_name ⇒ String
Campaign name.
-
#campaign_time_window_list ⇒ Array[V3TimeWindow]
List of allowed campaign time windows.
-
#device_list ⇒ Array[String]
Device IMEI list.
-
#end_date ⇒ Date
Campaign end date.
-
#firmware_from ⇒ String
Old firmware version.
-
#firmware_name ⇒ String
Firmware name to upgrade to.
-
#firmware_to ⇒ String
New firmware version.
-
#protocol ⇒ String
Valid values include: LWM2M, OMA and HTTP.
-
#start_date ⇒ Date
Campaign start date.
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(firmware_name = nil, firmware_from = nil, firmware_to = nil, protocol = 'LWM2M', start_date = nil, end_date = nil, device_list = nil, auto_assign_license_flag = nil, auto_add_devices_flag = nil, campaign_name = SKIP, campaign_time_window_list = SKIP) ⇒ CampaignFirmwareUpgrade
constructor
A new instance of CampaignFirmwareUpgrade.
Methods inherited from BaseModel
Constructor Details
#initialize(firmware_name = nil, firmware_from = nil, firmware_to = nil, protocol = 'LWM2M', start_date = nil, end_date = nil, device_list = nil, auto_assign_license_flag = nil, auto_add_devices_flag = nil, campaign_name = SKIP, campaign_time_window_list = SKIP) ⇒ CampaignFirmwareUpgrade
Returns a new instance of CampaignFirmwareUpgrade.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 88 def initialize(firmware_name = nil, firmware_from = nil, firmware_to = nil, protocol = 'LWM2M', start_date = nil, end_date = nil, device_list = nil, auto_assign_license_flag = nil, auto_add_devices_flag = nil, campaign_name = SKIP, campaign_time_window_list = SKIP) @campaign_name = campaign_name unless campaign_name == SKIP @firmware_name = firmware_name @firmware_from = firmware_from @firmware_to = firmware_to @protocol = protocol @start_date = start_date @end_date = end_date unless campaign_time_window_list == SKIP @campaign_time_window_list = campaign_time_window_list end @device_list = device_list @auto_assign_license_flag = auto_assign_license_flag @auto_add_devices_flag = auto_add_devices_flag end |
Instance Attribute Details
#auto_add_devices_flag ⇒ TrueClass | FalseClass
this flag, when set to true, will automatically add a device of the same make and model to a campaign.
56 57 58 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 56 def auto_add_devices_flag @auto_add_devices_flag end |
#auto_assign_license_flag ⇒ TrueClass | FalseClass
This flag, when set to true, will assign a FOTA license automatically if the device does not have one already.
51 52 53 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 51 def auto_assign_license_flag @auto_assign_license_flag end |
#campaign_name ⇒ String
Campaign name.
14 15 16 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 14 def campaign_name @campaign_name end |
#campaign_time_window_list ⇒ Array[V3TimeWindow]
List of allowed campaign time windows.
42 43 44 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 42 def campaign_time_window_list @campaign_time_window_list end |
#device_list ⇒ Array[String]
Device IMEI list.
46 47 48 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 46 def device_list @device_list end |
#end_date ⇒ Date
Campaign end date.
38 39 40 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 38 def end_date @end_date end |
#firmware_from ⇒ String
Old firmware version.
22 23 24 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 22 def firmware_from @firmware_from end |
#firmware_name ⇒ String
Firmware name to upgrade to.
18 19 20 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 18 def firmware_name @firmware_name end |
#firmware_to ⇒ String
New firmware version.
26 27 28 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 26 def firmware_to @firmware_to end |
#protocol ⇒ String
Valid values include: LWM2M, OMA and HTTP.
30 31 32 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 30 def protocol @protocol end |
#start_date ⇒ Date
Campaign start date.
34 35 36 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 34 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 142 143 144 145 146 147 148 149 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 110 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : nil firmware_from = hash.key?('firmwareFrom') ? hash['firmwareFrom'] : nil firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : nil protocol = hash['protocol'] ||= 'LWM2M' start_date = hash.key?('startDate') ? hash['startDate'] : nil end_date = hash.key?('endDate') ? hash['endDate'] : nil device_list = hash.key?('deviceList') ? hash['deviceList'] : nil auto_assign_license_flag = hash.key?('autoAssignLicenseFlag') ? hash['autoAssignLicenseFlag'] : nil auto_add_devices_flag = hash.key?('autoAddDevicesFlag') ? hash['autoAddDevicesFlag'] : nil campaign_name = hash.key?('campaignName') ? hash['campaignName'] : SKIP # 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 object from extracted values. CampaignFirmwareUpgrade.new(firmware_name, firmware_from, firmware_to, protocol, start_date, end_date, device_list, auto_assign_license_flag, auto_add_devices_flag, campaign_name, campaign_time_window_list) end |
.names ⇒ Object
A mapping from model property names to API property names.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 59 def self.names @_hash = {} if @_hash.nil? @_hash['campaign_name'] = 'campaignName' @_hash['firmware_name'] = 'firmwareName' @_hash['firmware_from'] = 'firmwareFrom' @_hash['firmware_to'] = 'firmwareTo' @_hash['protocol'] = 'protocol' @_hash['start_date'] = 'startDate' @_hash['end_date'] = 'endDate' @_hash['campaign_time_window_list'] = 'campaignTimeWindowList' @_hash['device_list'] = 'deviceList' @_hash['auto_assign_license_flag'] = 'autoAssignLicenseFlag' @_hash['auto_add_devices_flag'] = 'autoAddDevicesFlag' @_hash end |
.nullables ⇒ Object
An array for nullable fields
84 85 86 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 84 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 |
# File 'lib/verizon/models/campaign_firmware_upgrade.rb', line 76 def self.optionals %w[ campaign_name campaign_time_window_list ] end |