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) ⇒ UsageHistory
constructor
A new instance of UsageHistory.
- #to_custom_event_date_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(bytes_used = SKIP, serviceplan = SKIP, sms_used = SKIP, mo_sms = SKIP, mt_sms = SKIP, source = SKIP, event_date_time = SKIP) ⇒ UsageHistory
Returns a new instance of UsageHistory.
72 73 74 75 76 77 78 79 80 81 82 |
# 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) @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 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.
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 |
# File 'lib/verizon/models/usage_history.rb', line 85 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 object from extracted values. UsageHistory.new(bytes_used, serviceplan, sms_used, mo_sms, mt_sms, source, event_date_time) 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
#to_custom_event_date_time ⇒ Object
111 112 113 |
# File 'lib/verizon/models/usage_history.rb', line 111 def to_custom_event_date_time DateTimeHelper.to_rfc3339(event_date_time) end |