Class: ShellEv::ConnectorVO

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_ev/models/connector_vo.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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP, electrical_properties = SKIP, fixed_cable = SKIP, tariff = SKIP, updated = SKIP, updated_by = SKIP, deleted = SKIP) ⇒ ConnectorVO

Returns a new instance of ConnectorVO.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/shell_ev/models/connector_vo.rb', line 86

def initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP,
               electrical_properties = SKIP, fixed_cable = SKIP,
               tariff = SKIP, updated = SKIP, updated_by = SKIP,
               deleted = 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
  @fixed_cable = fixed_cable unless fixed_cable == SKIP
  @tariff = tariff unless tariff == SKIP
  @updated = updated unless updated == SKIP
  @updated_by = updated_by unless updated_by == SKIP
  @deleted = deleted unless deleted == SKIP
end

Instance Attribute Details

#connector_typeConnectorVOConnectorTypeEnum

Type of the connector in the EVSE unit.



24
25
26
# File 'lib/shell_ev/models/connector_vo.rb', line 24

def connector_type
  @connector_type
end

#deletedString

optional ISO8601-compliant UTC deletion timestamp of the connector

Returns:

  • (String)


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

def deleted
  @deleted
end

#electrical_propertiesElectricalProperties

Electrical Properties of the Connector



28
29
30
# File 'lib/shell_ev/models/connector_vo.rb', line 28

def electrical_properties
  @electrical_properties
end

#external_idString

Identifier of the Evse as given by the Operator, unique for the containing EVSE’

Returns:

  • (String)


20
21
22
# File 'lib/shell_ev/models/connector_vo.rb', line 20

def external_id
  @external_id
end

#fixed_cableTrueClass | FalseClass

Indicates whether Connector has a fixed cable attached. False by default (not sent in this case)

Returns:

  • (TrueClass | FalseClass)


33
34
35
# File 'lib/shell_ev/models/connector_vo.rb', line 33

def fixed_cable
  @fixed_cable
end

#tariffTariffVO

Tariff details for charging on this Connector

Returns:



37
38
39
# File 'lib/shell_ev/models/connector_vo.rb', line 37

def tariff
  @tariff
end

#uidInteger

Internal identifier used to refer to this Connector

Returns:

  • (Integer)


15
16
17
# File 'lib/shell_ev/models/connector_vo.rb', line 15

def uid
  @uid
end

#updatedString

ISO8601-compliant UTC datetime of the last update of the Connector’s data

Returns:

  • (String)


41
42
43
# File 'lib/shell_ev/models/connector_vo.rb', line 41

def updated
  @updated
end

#updated_byConnectorVOUpdatedByEnum

Source of the last update



45
46
47
# File 'lib/shell_ev/models/connector_vo.rb', line 45

def updated_by
  @updated_by
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/shell_ev/models/connector_vo.rb', line 102

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 = ElectricalProperties.from_hash(hash['electricalProperties']) if
    hash['electricalProperties']
  fixed_cable = hash.key?('fixedCable') ? hash['fixedCable'] : SKIP
  tariff = TariffVO.from_hash(hash['tariff']) if hash['tariff']
  updated = hash.key?('updated') ? hash['updated'] : SKIP
  updated_by = hash.key?('updatedBy') ? hash['updatedBy'] : SKIP
  deleted = hash.key?('deleted') ? hash['deleted'] : SKIP

  # Create object from extracted values.
  ConnectorVO.new(uid,
                  external_id,
                  connector_type,
                  electrical_properties,
                  fixed_cable,
                  tariff,
                  updated,
                  updated_by,
                  deleted)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/shell_ev/models/connector_vo.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['external_id'] = 'externalId'
  @_hash['connector_type'] = 'connectorType'
  @_hash['electrical_properties'] = 'electricalProperties'
  @_hash['fixed_cable'] = 'fixedCable'
  @_hash['tariff'] = 'tariff'
  @_hash['updated'] = 'updated'
  @_hash['updated_by'] = 'updatedBy'
  @_hash['deleted'] = 'deleted'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/shell_ev/models/connector_vo.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/shell_ev/models/connector_vo.rb', line 67

def self.optionals
  %w[
    uid
    external_id
    connector_type
    electrical_properties
    fixed_cable
    tariff
    updated
    updated_by
    deleted
  ]
end