Class: Verizon::V3CampaignDevice
- Defined in:
- lib/verizon/models/v3_campaign_device.rb
Overview
Campaign history.
Instance Attribute Summary collapse
-
#device_list ⇒ Array[V3DeviceStatus]
List of devices with id in IMEI.
-
#has_more_data ⇒ TrueClass | FalseClass
Has more report flag.
-
#last_seen_device_id ⇒ String
Device identifier.
-
#max_page_size ⇒ Integer
Maximum page size.
-
#total_device ⇒ Integer
Total device count.
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(has_more_data:, max_page_size:, device_list:, total_device: SKIP, last_seen_device_id: SKIP, additional_properties: nil) ⇒ V3CampaignDevice
constructor
A new instance of V3CampaignDevice.
-
#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(has_more_data:, max_page_size:, device_list:, total_device: SKIP, last_seen_device_id: SKIP, additional_properties: nil) ⇒ V3CampaignDevice
Returns a new instance of V3CampaignDevice.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 56 def initialize(has_more_data:, max_page_size:, device_list:, total_device: SKIP, last_seen_device_id: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @total_device = total_device unless total_device == SKIP @has_more_data = has_more_data @last_seen_device_id = last_seen_device_id unless last_seen_device_id == SKIP @max_page_size = max_page_size @device_list = device_list @additional_properties = additional_properties end |
Instance Attribute Details
#device_list ⇒ Array[V3DeviceStatus]
List of devices with id in IMEI.
30 31 32 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 30 def device_list @device_list end |
#has_more_data ⇒ TrueClass | FalseClass
Has more report flag.
18 19 20 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 18 def has_more_data @has_more_data end |
#last_seen_device_id ⇒ String
Device identifier.
22 23 24 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 22 def last_seen_device_id @last_seen_device_id end |
#max_page_size ⇒ Integer
Maximum page size.
26 27 28 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 26 def max_page_size @max_page_size end |
#total_device ⇒ Integer
Total device count.
14 15 16 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 14 def total_device @total_device end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : nil max_page_size = hash.key?('maxPageSize') ? hash['maxPageSize'] : nil # Parameter is an array, so we need to iterate through it device_list = nil unless hash['deviceList'].nil? device_list = [] hash['deviceList'].each do |structure| device_list << (V3DeviceStatus.from_hash(structure) if structure) end end device_list = nil unless hash.key?('deviceList') total_device = hash.key?('totalDevice') ? hash['totalDevice'] : SKIP last_seen_device_id = hash.key?('lastSeenDeviceId') ? hash['lastSeenDeviceId'] : SKIP # 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. V3CampaignDevice.new(has_more_data: has_more_data, max_page_size: max_page_size, device_list: device_list, total_device: total_device, last_seen_device_id: last_seen_device_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['total_device'] = 'totalDevice' @_hash['has_more_data'] = 'hasMoreData' @_hash['last_seen_device_id'] = 'lastSeenDeviceId' @_hash['max_page_size'] = 'maxPageSize' @_hash['device_list'] = 'deviceList' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 44 def self.optionals %w[ total_device last_seen_device_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
116 117 118 119 120 121 122 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 116 def inspect class_name = self.class.name.split('::').last "<#{class_name} total_device: #{@total_device.inspect}, has_more_data:"\ " #{@has_more_data.inspect}, last_seen_device_id: #{@last_seen_device_id.inspect},"\ " max_page_size: #{@max_page_size.inspect}, device_list: #{@device_list.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
108 109 110 111 112 113 |
# File 'lib/verizon/models/v3_campaign_device.rb', line 108 def to_s class_name = self.class.name.split('::').last "<#{class_name} total_device: #{@total_device}, has_more_data: #{@has_more_data},"\ " last_seen_device_id: #{@last_seen_device_id}, max_page_size: #{@max_page_size},"\ " device_list: #{@device_list}, additional_properties: #{@additional_properties}>" end |