Class: ShellEv::TariffVO
- Defined in:
- lib/shell_ev/models/tariff_vo.rb
Overview
Tariff details for charging on this Connector
Instance Attribute Summary collapse
-
#currency ⇒ String
ISO 4217 Currency Code of the local currency.
-
#per_k_wh ⇒ Float
Tariff per kWh of energy consumed.
-
#per_minute ⇒ Float
Tariff per minute of charging time.
-
#start_fee ⇒ Float
Tariff to start a charging session.
-
#structure ⇒ String
Tariff structure that this tariff belongs to, typically Default unless specific tariff is defined for provider.
-
#updated ⇒ String
ISO8601-compliant UTC datetime of the last update of the Tariff.
-
#updated_by ⇒ TariffVOUpdatedByEnum
Source of the last update of the tariff details.
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(start_fee = SKIP, per_minute = SKIP, per_k_wh = SKIP, currency = SKIP, updated = SKIP, updated_by = SKIP, structure = SKIP) ⇒ TariffVO
constructor
A new instance of TariffVO.
Methods inherited from BaseModel
Constructor Details
#initialize(start_fee = SKIP, per_minute = SKIP, per_k_wh = SKIP, currency = SKIP, updated = SKIP, updated_by = SKIP, structure = SKIP) ⇒ TariffVO
Returns a new instance of TariffVO.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 72 def initialize(start_fee = SKIP, per_minute = SKIP, per_k_wh = SKIP, currency = SKIP, updated = SKIP, updated_by = SKIP, structure = SKIP) @start_fee = start_fee unless start_fee == SKIP @per_minute = per_minute unless per_minute == SKIP @per_k_wh = per_k_wh unless per_k_wh == SKIP @currency = currency unless currency == SKIP @updated = updated unless updated == SKIP @updated_by = updated_by unless updated_by == SKIP @structure = structure unless structure == SKIP end |
Instance Attribute Details
#currency ⇒ String
ISO 4217 Currency Code of the local currency.
26 27 28 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 26 def currency @currency end |
#per_k_wh ⇒ Float
Tariff per kWh of energy consumed
22 23 24 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 22 def per_k_wh @per_k_wh end |
#per_minute ⇒ Float
Tariff per minute of charging time
18 19 20 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 18 def per_minute @per_minute end |
#start_fee ⇒ Float
Tariff to start a charging session
14 15 16 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 14 def start_fee @start_fee end |
#structure ⇒ String
Tariff structure that this tariff belongs to, typically Default unless specific tariff is defined for provider
39 40 41 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 39 def structure @structure end |
#updated ⇒ String
ISO8601-compliant UTC datetime of the last update of the Tariff
30 31 32 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 30 def updated @updated end |
#updated_by ⇒ TariffVOUpdatedByEnum
Source of the last update of the tariff details
34 35 36 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 34 def updated_by @updated_by 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 |
# File 'lib/shell_ev/models/tariff_vo.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start_fee = hash.key?('startFee') ? hash['startFee'] : SKIP per_minute = hash.key?('perMinute') ? hash['perMinute'] : SKIP per_k_wh = hash.key?('perKWh') ? hash['perKWh'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP updated = hash.key?('updated') ? hash['updated'] : SKIP updated_by = hash.key?('updatedBy') ? hash['updatedBy'] : SKIP structure = hash.key?('structure') ? hash['structure'] : SKIP # Create object from extracted values. TariffVO.new(start_fee, per_minute, per_k_wh, currency, updated, updated_by, structure) 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/shell_ev/models/tariff_vo.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['start_fee'] = 'startFee' @_hash['per_minute'] = 'perMinute' @_hash['per_k_wh'] = 'perKWh' @_hash['currency'] = 'currency' @_hash['updated'] = 'updated' @_hash['updated_by'] = 'updatedBy' @_hash['structure'] = 'structure' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/shell_ev/models/tariff_vo.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/shell_ev/models/tariff_vo.rb', line 55 def self.optionals %w[ start_fee per_minute per_k_wh currency updated updated_by structure ] end |