Class: Verizon::UpgradeListQueryResult

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

Overview

Upgrade information.

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_flag = SKIP, last_seen_upgrade_id = SKIP, report_list = SKIP) ⇒ UpgradeListQueryResult

Returns a new instance of UpgradeListQueryResult.



50
51
52
53
54
55
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 50

def initialize(has_more_flag = SKIP, last_seen_upgrade_id = SKIP,
               report_list = SKIP)
  @has_more_flag = has_more_flag unless has_more_flag == SKIP
  @last_seen_upgrade_id = last_seen_upgrade_id unless last_seen_upgrade_id == SKIP
  @report_list = report_list unless report_list == SKIP
end

Instance Attribute Details

#has_more_flagTrueClass | FalseClass

True if there are more devices to retrieve.

Returns:

  • (TrueClass | FalseClass)


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

def has_more_flag
  @has_more_flag
end

#last_seen_upgrade_idInteger

If hasMoreData=true, the startIndex to use for the next request. 0 if hasMoreData=false.

Returns:

  • (Integer)


19
20
21
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 19

def last_seen_upgrade_id
  @last_seen_upgrade_id
end

#report_listArray[FirmwareUpgrade]

Array of upgrade objects with the specified status.

Returns:



23
24
25
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 23

def report_list
  @report_list
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  has_more_flag = hash.key?('hasMoreFlag') ? hash['hasMoreFlag'] : SKIP
  last_seen_upgrade_id =
    hash.key?('lastSeenUpgradeId') ? hash['lastSeenUpgradeId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  report_list = nil
  unless hash['reportList'].nil?
    report_list = []
    hash['reportList'].each do |structure|
      report_list << (FirmwareUpgrade.from_hash(structure) if structure)
    end
  end

  report_list = SKIP unless hash.key?('reportList')

  # Create object from extracted values.
  UpgradeListQueryResult.new(has_more_flag,
                             last_seen_upgrade_id,
                             report_list)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['has_more_flag'] = 'hasMoreFlag'
  @_hash['last_seen_upgrade_id'] = 'lastSeenUpgradeId'
  @_hash['report_list'] = 'reportList'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
47
48
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 44

def self.nullables
  %w[
    report_list
  ]
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
41
# File 'lib/verizon/models/upgrade_list_query_result.rb', line 35

def self.optionals
  %w[
    has_more_flag
    last_seen_upgrade_id
    report_list
  ]
end