Class: Verizon::DailyUsageResponse
- Defined in:
- lib/verizon/models/daily_usage_response.rb
Overview
DailyUsageResponse Model.
Instance Attribute Summary collapse
-
#device_id ⇒ GIODeviceId
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false).
-
#has_more_data ⇒ TrueClass | FalseClass
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false).
-
#usage_history ⇒ Array[DailyUsageHistory]
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false).
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 = SKIP, device_id = SKIP, usage_history = SKIP) ⇒ DailyUsageResponse
constructor
A new instance of DailyUsageResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(has_more_data = SKIP, device_id = SKIP, usage_history = SKIP) ⇒ DailyUsageResponse
Returns a new instance of DailyUsageResponse.
50 51 52 53 54 |
# File 'lib/verizon/models/daily_usage_response.rb', line 50 def initialize(has_more_data = SKIP, device_id = SKIP, usage_history = SKIP) @has_more_data = has_more_data unless has_more_data == SKIP @device_id = device_id unless device_id == SKIP @usage_history = usage_history unless usage_history == SKIP end |
Instance Attribute Details
#device_id ⇒ GIODeviceId
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false)
20 21 22 |
# File 'lib/verizon/models/daily_usage_response.rb', line 20 def device_id @device_id end |
#has_more_data ⇒ TrueClass | FalseClass
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false)
15 16 17 |
# File 'lib/verizon/models/daily_usage_response.rb', line 15 def has_more_data @has_more_data end |
#usage_history ⇒ Array[DailyUsageHistory]
A flag set to indicate if there is more than one page of data returned by the query (true) or if only one page of data returned (false)
25 26 27 |
# File 'lib/verizon/models/daily_usage_response.rb', line 25 def usage_history @usage_history end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/verizon/models/daily_usage_response.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : SKIP device_id = GIODeviceId.from_hash(hash['deviceId']) if hash['deviceId'] # Parameter is an array, so we need to iterate through it usage_history = nil unless hash['usageHistory'].nil? usage_history = [] hash['usageHistory'].each do |structure| usage_history << (DailyUsageHistory.from_hash(structure) if structure) end end usage_history = SKIP unless hash.key?('usageHistory') # Create object from extracted values. DailyUsageResponse.new(has_more_data, device_id, usage_history) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/verizon/models/daily_usage_response.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['has_more_data'] = 'hasMoreData' @_hash['device_id'] = 'deviceId' @_hash['usage_history'] = 'usageHistory' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/verizon/models/daily_usage_response.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 42 43 |
# File 'lib/verizon/models/daily_usage_response.rb', line 37 def self.optionals %w[ has_more_data device_id usage_history ] end |