Class: ShellEv::TariffVO

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_ev/models/tariff_vo.rb

Overview

Tariff details for charging on this Connector

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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

#currencyString

ISO 4217 Currency Code of the local currency.

Returns:

  • (String)


26
27
28
# File 'lib/shell_ev/models/tariff_vo.rb', line 26

def currency
  @currency
end

#per_k_whFloat

Tariff per kWh of energy consumed

Returns:

  • (Float)


22
23
24
# File 'lib/shell_ev/models/tariff_vo.rb', line 22

def per_k_wh
  @per_k_wh
end

#per_minuteFloat

Tariff per minute of charging time

Returns:

  • (Float)


18
19
20
# File 'lib/shell_ev/models/tariff_vo.rb', line 18

def per_minute
  @per_minute
end

#start_feeFloat

Tariff to start a charging session

Returns:

  • (Float)


14
15
16
# File 'lib/shell_ev/models/tariff_vo.rb', line 14

def start_fee
  @start_fee
end

#structureString

Tariff structure that this tariff belongs to, typically Default unless specific tariff is defined for provider

Returns:

  • (String)


39
40
41
# File 'lib/shell_ev/models/tariff_vo.rb', line 39

def structure
  @structure
end

#updatedString

ISO8601-compliant UTC datetime of the last update of the Tariff

Returns:

  • (String)


30
31
32
# File 'lib/shell_ev/models/tariff_vo.rb', line 30

def updated
  @updated
end

#updated_byTariffVOUpdatedByEnum

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

.namesObject

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

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/shell_ev/models/tariff_vo.rb', line 68

def self.nullables
  []
end

.optionalsObject

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