Class: ShellEv::ElectricalProperties
- Defined in:
- lib/shell_ev/models/electrical_properties.rb
Overview
Electrical Properties of the Connector
Instance Attribute Summary collapse
-
#amperage ⇒ Float
Electric Current in Amperes for this connector.
-
#max_electric_power ⇒ Float
Power in Kilowatts for this connector.
-
#power_type ⇒ ElectricalPropertiesPowerTypeEnum
Power Type used in this connector.
-
#voltage ⇒ Float
Voltage in Volts for this connector.
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(power_type = SKIP, voltage = SKIP, amperage = SKIP, max_electric_power = SKIP) ⇒ ElectricalProperties
constructor
A new instance of ElectricalProperties.
Methods inherited from BaseModel
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
#amperage ⇒ Float
Electric Current in Amperes for this connector
22 23 24 |
# File 'lib/shell_ev/models/electrical_properties.rb', line 22 def amperage @amperage end |
#max_electric_power ⇒ Float
Power in Kilowatts for this connector
26 27 28 |
# File 'lib/shell_ev/models/electrical_properties.rb', line 26 def max_electric_power @max_electric_power end |
#power_type ⇒ ElectricalPropertiesPowerTypeEnum
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 |
#voltage ⇒ Float
Voltage in Volts for this connector
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 |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/shell_ev/models/electrical_properties.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
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 |