Class: Verizon::UsageHistory
- Defined in:
- lib/verizon/models/usage_history.rb
Overview
UsageHistory Model.
Instance Attribute Summary collapse
-
#bytes_used ⇒ Integer
TODO: Write general description for this method.
-
#event_date_time ⇒ DateTime
TODO: Write general description for this method.
-
#mo_sms ⇒ Integer
TODO: Write general description for this method.
-
#mt_sms ⇒ Integer
TODO: Write general description for this method.
-
#serviceplan ⇒ String
TODO: Write general description for this method.
-
#sms_used ⇒ Integer
TODO: Write general description for this method.
-
#source ⇒ String
TODO: Write general description for this method.
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, serviceplan: SKIP, sms_used: SKIP, mo_sms: SKIP, mt_sms: SKIP, source: SKIP, event_date_time: SKIP, additional_properties: nil) ⇒ UsageHistory
constructor
A new instance of UsageHistory.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_event_date_time ⇒ Object
-
#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, serviceplan: SKIP, sms_used: SKIP, mo_sms: SKIP, mt_sms: SKIP, source: SKIP, event_date_time: SKIP, additional_properties: nil) ⇒ UsageHistory
Returns a new instance of UsageHistory.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/verizon/models/usage_history.rb', line 72 def initialize(bytes_used: SKIP, serviceplan: SKIP, sms_used: SKIP, mo_sms: SKIP, mt_sms: SKIP, source: SKIP, event_date_time: 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 @serviceplan = serviceplan unless serviceplan == SKIP @sms_used = sms_used unless sms_used == SKIP @mo_sms = mo_sms unless mo_sms == SKIP @mt_sms = mt_sms unless mt_sms == SKIP @source = source unless source == SKIP @event_date_time = event_date_time unless event_date_time == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bytes_used ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/verizon/models/usage_history.rb', line 15 def bytes_used @bytes_used end |
#event_date_time ⇒ DateTime
TODO: Write general description for this method
39 40 41 |
# File 'lib/verizon/models/usage_history.rb', line 39 def event_date_time @event_date_time end |
#mo_sms ⇒ Integer
TODO: Write general description for this method
27 28 29 |
# File 'lib/verizon/models/usage_history.rb', line 27 def mo_sms @mo_sms end |
#mt_sms ⇒ Integer
TODO: Write general description for this method
31 32 33 |
# File 'lib/verizon/models/usage_history.rb', line 31 def mt_sms @mt_sms end |
#serviceplan ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/verizon/models/usage_history.rb', line 19 def serviceplan @serviceplan end |
#sms_used ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/verizon/models/usage_history.rb', line 23 def sms_used @sms_used end |
#source ⇒ String
TODO: Write general description for this method
35 36 37 |
# File 'lib/verizon/models/usage_history.rb', line 35 def source @source end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 117 118 119 120 121 |
# File 'lib/verizon/models/usage_history.rb', line 89 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. bytes_used = hash.key?('bytesUsed') ? hash['bytesUsed'] : SKIP serviceplan = hash.key?('serviceplan') ? hash['serviceplan'] : SKIP sms_used = hash.key?('smsUsed') ? hash['smsUsed'] : SKIP mo_sms = hash.key?('moSMS') ? hash['moSMS'] : SKIP mt_sms = hash.key?('mtSMS') ? hash['mtSMS'] : SKIP source = hash.key?('source') ? hash['source'] : SKIP event_date_time = if hash.key?('eventDateTime') (DateTimeHelper.from_rfc3339(hash['eventDateTime']) if hash['eventDateTime']) else SKIP end # 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. UsageHistory.new(bytes_used: bytes_used, serviceplan: serviceplan, sms_used: sms_used, mo_sms: mo_sms, mt_sms: mt_sms, source: source, event_date_time: event_date_time, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/verizon/models/usage_history.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['bytes_used'] = 'bytesUsed' @_hash['serviceplan'] = 'serviceplan' @_hash['sms_used'] = 'smsUsed' @_hash['mo_sms'] = 'moSMS' @_hash['mt_sms'] = 'mtSMS' @_hash['source'] = 'source' @_hash['event_date_time'] = 'eventDateTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/verizon/models/usage_history.rb', line 68 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/verizon/models/usage_history.rb', line 55 def self.optionals %w[ bytes_used serviceplan sms_used mo_sms mt_sms source event_date_time ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
136 137 138 139 140 141 142 |
# File 'lib/verizon/models/usage_history.rb', line 136 def inspect class_name = self.class.name.split('::').last "<#{class_name} bytes_used: #{@bytes_used.inspect}, serviceplan: #{@serviceplan.inspect},"\ " sms_used: #{@sms_used.inspect}, mo_sms: #{@mo_sms.inspect}, mt_sms: #{@mt_sms.inspect},"\ " source: #{@source.inspect}, event_date_time: #{@event_date_time.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_event_date_time ⇒ Object
123 124 125 |
# File 'lib/verizon/models/usage_history.rb', line 123 def to_custom_event_date_time DateTimeHelper.to_rfc3339(event_date_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
128 129 130 131 132 133 |
# File 'lib/verizon/models/usage_history.rb', line 128 def to_s class_name = self.class.name.split('::').last "<#{class_name} bytes_used: #{@bytes_used}, serviceplan: #{@serviceplan}, sms_used:"\ " #{@sms_used}, mo_sms: #{@mo_sms}, mt_sms: #{@mt_sms}, source: #{@source}, event_date_time:"\ " #{@event_date_time}, additional_properties: #{@additional_properties}>" end |