Class: Verizon::V2CampaignHistory

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

Overview

Campaign history details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_listArray[V2CampaignMetaInfo]

Software upgrade list.

Returns:



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

def campaign_list
  @campaign_list
end

#has_more_dataTrueClass | FalseClass

Has more report flag.

Returns:

  • (TrueClass | FalseClass)


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

def has_more_data
  @has_more_data
end

#last_seen_campaign_idString

Campaign identifier.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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