Class: ShellEv::SearchByIdConnector
- Defined in:
- lib/shell_ev/models/search_by_id_connector.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’.
-
#tariffs ⇒ Array[TariffV2]
Tariffs applicable to this Connector.
-
#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, tariffs = SKIP) ⇒ SearchByIdConnector
constructor
A new instance of SearchByIdConnector.
-
#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, tariffs = SKIP) ⇒ SearchByIdConnector
Returns a new instance of SearchByIdConnector.
61 62 63 64 65 66 67 68 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 61 def initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP, electrical_properties = SKIP, tariffs = 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 @tariffs = tariffs unless tariffs == SKIP end |
Instance Attribute Details
#connector_type ⇒ ConnectorVOConnectorTypeEnum
Type of the connector in the EVSE unit.
24 25 26 |
# File 'lib/shell_ev/models/search_by_id_connector.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/search_by_id_connector.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/search_by_id_connector.rb', line 20 def external_id @external_id end |
#tariffs ⇒ Array[TariffV2]
Tariffs applicable to this Connector
32 33 34 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 32 def tariffs @tariffs end |
#uid ⇒ String
Internal identifier used to refer to this Connector
15 16 17 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 15 def uid @uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 71 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'] # Parameter is an array, so we need to iterate through it tariffs = nil unless hash['tariffs'].nil? tariffs = [] hash['tariffs'].each do |structure| tariffs << (TariffV2.from_hash(structure) if structure) end end tariffs = SKIP unless hash.key?('tariffs') # Create object from extracted values. SearchByIdConnector.new(uid, external_id, connector_type, electrical_properties, tariffs) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['uid'] = 'uid' @_hash['external_id'] = 'externalId' @_hash['connector_type'] = 'connectorType' @_hash['electrical_properties'] = 'electricalProperties' @_hash['tariffs'] = 'tariffs' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 54 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 46 def self.optionals %w[ uid external_id connector_type electrical_properties tariffs ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
108 109 110 111 112 113 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 108 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},"\ " tariffs: #{@tariffs.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
100 101 102 103 104 105 |
# File 'lib/shell_ev/models/search_by_id_connector.rb', line 100 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}, tariffs:"\ " #{@tariffs}>" end |