Class: Verizon::V2CampaignHistory
- Defined in:
- lib/verizon/models/v2_campaign_history.rb
Overview
Campaign history details.
Instance Attribute Summary collapse
-
#campaign_list ⇒ Array[V2CampaignMetaInfo]
Software upgrade list.
-
#has_more_data ⇒ TrueClass | FalseClass
Has more report flag.
-
#last_seen_campaign_id ⇒ String
Campaign identifier.
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 = nil, campaign_list = nil, last_seen_campaign_id = SKIP) ⇒ V2CampaignHistory
constructor
A new instance of V2CampaignHistory.
Methods inherited from BaseModel
Constructor Details
#initialize(has_more_data = nil, campaign_list = nil, last_seen_campaign_id = SKIP) ⇒ V2CampaignHistory
Returns a new instance of V2CampaignHistory.
47 48 49 50 51 52 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 47 def initialize(has_more_data = nil, campaign_list = nil, last_seen_campaign_id = SKIP) @has_more_data = has_more_data @last_seen_campaign_id = last_seen_campaign_id unless last_seen_campaign_id == SKIP @campaign_list = campaign_list end |
Instance Attribute Details
#campaign_list ⇒ Array[V2CampaignMetaInfo]
Software upgrade list.
22 23 24 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 22 def campaign_list @campaign_list end |
#has_more_data ⇒ TrueClass | FalseClass
Has more report flag.
14 15 16 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 14 def has_more_data @has_more_data end |
#last_seen_campaign_id ⇒ String
Campaign identifier.
18 19 20 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 18 def last_seen_campaign_id @last_seen_campaign_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : nil # Parameter is an array, so we need to iterate through it campaign_list = nil unless hash['campaignList'].nil? campaign_list = [] hash['campaignList'].each do |structure| campaign_list << (V2CampaignMetaInfo.from_hash(structure) if structure) end end campaign_list = nil unless hash.key?('campaignList') last_seen_campaign_id = hash.key?('lastSeenCampaignId') ? hash['lastSeenCampaignId'] : SKIP # Create object from extracted values. V2CampaignHistory.new(has_more_data, campaign_list, last_seen_campaign_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['has_more_data'] = 'hasMoreData' @_hash['last_seen_campaign_id'] = 'lastSeenCampaignId' @_hash['campaign_list'] = 'campaignList' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 44 45 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 41 def self.nullables %w[ campaign_list ] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 |
# File 'lib/verizon/models/v2_campaign_history.rb', line 34 def self.optionals %w[ last_seen_campaign_id ] end |