Class: ShellEv::ConnectorV2
- Defined in:
- lib/shell_ev/models/connector_v2.rb
Overview
An EVSE can have one or many Connectors. Each Connector will normally have a different socket / cable and only one can be used to charge at a time.
Instance Attribute Summary collapse
-
#connector_type ⇒ ConnectorVOConnectorTypeEnum
Type of the connector in the EVSE unit.
-
#electrical_properties ⇒ ElectricalPropertiesV2
Electrical Properties of the Connector.
-
#external_id ⇒ String
Identifier of the Evse as given by the Operator, unique for the containing EVSE’.
-
#uid ⇒ String
Internal identifier used to refer to 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(uid = SKIP, external_id = SKIP, connector_type = SKIP, electrical_properties = SKIP) ⇒ ConnectorV2
constructor
A new instance of ConnectorV2.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP, electrical_properties = SKIP) ⇒ ConnectorV2
Returns a new instance of ConnectorV2.
55 56 57 58 59 60 61 |
# File 'lib/shell_ev/models/connector_v2.rb', line 55 def initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP, electrical_properties = SKIP) @uid = uid unless uid == SKIP @external_id = external_id unless external_id == SKIP @connector_type = connector_type unless connector_type == SKIP @electrical_properties = electrical_properties unless electrical_properties == SKIP end |
Instance Attribute Details
#connector_type ⇒ ConnectorVOConnectorTypeEnum
Type of the connector in the EVSE unit.
24 25 26 |
# File 'lib/shell_ev/models/connector_v2.rb', line 24 def connector_type @connector_type end |
#electrical_properties ⇒ ElectricalPropertiesV2
Electrical Properties of the Connector
28 29 30 |
# File 'lib/shell_ev/models/connector_v2.rb', line 28 def electrical_properties @electrical_properties end |
#external_id ⇒ String
Identifier of the Evse as given by the Operator, unique for the containing EVSE’
20 21 22 |
# File 'lib/shell_ev/models/connector_v2.rb', line 20 def external_id @external_id end |
#uid ⇒ String
Internal identifier used to refer to this Connector
15 16 17 |
# File 'lib/shell_ev/models/connector_v2.rb', line 15 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/shell_ev/models/connector_v2.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. uid = hash.key?('uid') ? hash['uid'] : SKIP external_id = hash.key?('externalId') ? hash['externalId'] : SKIP connector_type = hash.key?('connectorType') ? hash['connectorType'] : SKIP electrical_properties = ElectricalPropertiesV2.from_hash(hash['electricalProperties']) if hash['electricalProperties'] # Create object from extracted values. ConnectorV2.new(uid, external_id, connector_type, electrical_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/shell_ev/models/connector_v2.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['external_id'] = 'externalId' @_hash['connector_type'] = 'connectorType' @_hash['electrical_properties'] = 'electricalProperties' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/shell_ev/models/connector_v2.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/shell_ev/models/connector_v2.rb', line 41 def self.optionals %w[ uid external_id connector_type electrical_properties ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 |
# File 'lib/shell_ev/models/connector_v2.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} uid: #{@uid.inspect}, external_id: #{@external_id.inspect}, connector_type:"\ " #{@connector_type.inspect}, electrical_properties: #{@electrical_properties.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/shell_ev/models/connector_v2.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} uid: #{@uid}, external_id: #{@external_id}, connector_type:"\ " #{@connector_type}, electrical_properties: #{@electrical_properties}>" end |