Class: Verizon::DailyUsageHistory
- Defined in:
- lib/verizon/models/daily_usage_history.rb
Overview
DailyUsageHistory Model.
Instance Attribute Summary collapse
-
#bytes_used ⇒ String
the total data usage recorded in Bytes.
-
#extended_attributes ⇒ Array[ExtendedAttribute]
the total data usage recorded in Bytes.
-
#service_plan ⇒ String
the total data usage recorded in Bytes.
-
#sms_used ⇒ String
The total number of SMS messages from and to the device.
-
#source ⇒ String
Where the collected data is being gathered from.
-
#timestamp ⇒ String
Timestamp of when the retrieved record was completed ($datetime).
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(bytes_used: SKIP, extended_attributes: SKIP, service_plan: SKIP, sms_used: SKIP, source: SKIP, timestamp: SKIP, additional_properties: nil) ⇒ DailyUsageHistory
constructor
A new instance of DailyUsageHistory.
-
#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(bytes_used: SKIP, extended_attributes: SKIP, service_plan: SKIP, sms_used: SKIP, source: SKIP, timestamp: SKIP, additional_properties: nil) ⇒ DailyUsageHistory
Returns a new instance of DailyUsageHistory.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/verizon/models/daily_usage_history.rb', line 65 def initialize(bytes_used: SKIP, extended_attributes: SKIP, service_plan: SKIP, sms_used: SKIP, source: SKIP, timestamp: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @bytes_used = bytes_used unless bytes_used == SKIP @extended_attributes = extended_attributes unless extended_attributes == SKIP @service_plan = service_plan unless service_plan == SKIP @sms_used = sms_used unless sms_used == SKIP @source = source unless source == SKIP @timestamp = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bytes_used ⇒ String
the total data usage recorded in Bytes
14 15 16 |
# File 'lib/verizon/models/daily_usage_history.rb', line 14 def bytes_used @bytes_used end |
#extended_attributes ⇒ Array[ExtendedAttribute]
the total data usage recorded in Bytes
18 19 20 |
# File 'lib/verizon/models/daily_usage_history.rb', line 18 def extended_attributes @extended_attributes end |
#service_plan ⇒ String
the total data usage recorded in Bytes
22 23 24 |
# File 'lib/verizon/models/daily_usage_history.rb', line 22 def service_plan @service_plan end |
#sms_used ⇒ String
The total number of SMS messages from and to the device
26 27 28 |
# File 'lib/verizon/models/daily_usage_history.rb', line 26 def sms_used @sms_used end |
#source ⇒ String
Where the collected data is being gathered from
30 31 32 |
# File 'lib/verizon/models/daily_usage_history.rb', line 30 def source @source end |
#timestamp ⇒ String
Timestamp of when the retrieved record was completed ($datetime)
34 35 36 |
# File 'lib/verizon/models/daily_usage_history.rb', line 34 def @timestamp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/verizon/models/daily_usage_history.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. bytes_used = hash.key?('bytesUsed') ? hash['bytesUsed'] : SKIP # Parameter is an array, so we need to iterate through it extended_attributes = nil unless hash['extendedAttributes'].nil? extended_attributes = [] hash['extendedAttributes'].each do |structure| extended_attributes << (ExtendedAttribute.from_hash(structure) if structure) end end extended_attributes = SKIP unless hash.key?('extendedAttributes') service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP sms_used = hash.key?('smsUsed') ? hash['smsUsed'] : SKIP source = hash.key?('source') ? hash['source'] : SKIP = hash.key?('timestamp') ? hash['timestamp'] : 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. DailyUsageHistory.new(bytes_used: bytes_used, extended_attributes: extended_attributes, service_plan: service_plan, sms_used: sms_used, source: source, timestamp: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/verizon/models/daily_usage_history.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['bytes_used'] = 'bytesUsed' @_hash['extended_attributes'] = 'extendedAttributes' @_hash['service_plan'] = 'servicePlan' @_hash['sms_used'] = 'smsUsed' @_hash['source'] = 'source' @_hash['timestamp'] = 'timestamp' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/verizon/models/daily_usage_history.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/verizon/models/daily_usage_history.rb', line 49 def self.optionals %w[ bytes_used extended_attributes service_plan sms_used source timestamp ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 133 |
# File 'lib/verizon/models/daily_usage_history.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} bytes_used: #{@bytes_used.inspect}, extended_attributes:"\ " #{@extended_attributes.inspect}, service_plan: #{@service_plan.inspect}, sms_used:"\ " #{@sms_used.inspect}, source: #{@source.inspect}, timestamp: #{@timestamp.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
119 120 121 122 123 124 |
# File 'lib/verizon/models/daily_usage_history.rb', line 119 def to_s class_name = self.class.name.split('::').last "<#{class_name} bytes_used: #{@bytes_used}, extended_attributes: #{@extended_attributes},"\ " service_plan: #{@service_plan}, sms_used: #{@sms_used}, source: #{@source}, timestamp:"\ " #{@timestamp}, additional_properties: #{@additional_properties}>" end |