Class: ShellEv::ElectricalProperties

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

Overview

Electrical Properties of the Connector

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(power_type = SKIP, voltage = SKIP, amperage = SKIP, max_electric_power = SKIP) ⇒ ElectricalProperties

Returns a new instance of ElectricalProperties.



53
54
55
56
57
58
59
# File 'lib/shell_ev/models/electrical_properties.rb', line 53

def initialize(power_type = SKIP, voltage = SKIP, amperage = SKIP,
               max_electric_power = SKIP)
  @power_type = power_type unless power_type == SKIP
  @voltage = voltage unless voltage == SKIP
  @amperage = amperage unless amperage == SKIP
  @max_electric_power = max_electric_power unless max_electric_power == SKIP
end

Instance Attribute Details

#amperageFloat

Electric Current in Amperes for this connector

Returns:

  • (Float)


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

def amperage
  @amperage
end

#max_electric_powerFloat

Power in Kilowatts for this connector

Returns:

  • (Float)


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

def max_electric_power
  @max_electric_power
end

#power_typeElectricalPropertiesPowerTypeEnum

Power Type used in this connector.



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

def power_type
  @power_type
end

#voltageFloat

Voltage in Volts for this connector

Returns:

  • (Float)


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

def voltage
  @voltage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/shell_ev/models/electrical_properties.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  power_type = hash.key?('powerType') ? hash['powerType'] : SKIP
  voltage = hash.key?('voltage') ? hash['voltage'] : SKIP
  amperage = hash.key?('amperage') ? hash['amperage'] : SKIP
  max_electric_power =
    hash.key?('maxElectricPower') ? hash['maxElectricPower'] : SKIP

  # Create object from extracted values.
  ElectricalProperties.new(power_type,
                           voltage,
                           amperage,
                           max_electric_power)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/shell_ev/models/electrical_properties.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['power_type'] = 'powerType'
  @_hash['voltage'] = 'voltage'
  @_hash['amperage'] = 'amperage'
  @_hash['max_electric_power'] = 'maxElectricPower'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/shell_ev/models/electrical_properties.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/shell_ev/models/electrical_properties.rb', line 39

def self.optionals
  %w[
    power_type
    voltage
    amperage
    max_electric_power
  ]
end