Class: ShellEv::EvseVO

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

Overview

Each Location will contain one or more EVSEs (Electric Vehicle Supply Equipment). Each EVSE is capable of charging one car 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, evse_id = SKIP, status = SKIP, connectors = SKIP, authorization_methods = SKIP, updated = SKIP, deleted = SKIP, physical_reference = SKIP) ⇒ EvseVO

Returns a new instance of EvseVO.



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

def initialize(uid = SKIP, external_id = SKIP, evse_id = SKIP,
               status = SKIP, connectors = SKIP,
               authorization_methods = SKIP, updated = SKIP, deleted = SKIP,
               physical_reference = SKIP)
  @uid = uid unless uid == SKIP
  @external_id = external_id unless external_id == SKIP
  @evse_id = evse_id unless evse_id == SKIP
  @status = status unless status == SKIP
  @connectors = connectors unless connectors == SKIP
  @authorization_methods = authorization_methods unless authorization_methods == SKIP
  @updated = updated unless updated == SKIP
  @deleted = deleted unless deleted == SKIP
  @physical_reference = physical_reference unless physical_reference == SKIP
end

Instance Attribute Details

#authorization_methodsEvseVOAuthorizationMethodsEnum

Methods that can be used to Authorize sessions on this EVSE



35
36
37
# File 'lib/shell_ev/models/evse_vo.rb', line 35

def authorization_methods
  @authorization_methods
end

#connectorsArray[ConnectorVO]

List of all connectors available on this EVSE unit.

Returns:



31
32
33
# File 'lib/shell_ev/models/evse_vo.rb', line 31

def connectors
  @connectors
end

#deletedString

optional ISO8601-compliant UTC deletion timestamp of the Evse

Returns:

  • (String)


43
44
45
# File 'lib/shell_ev/models/evse_vo.rb', line 43

def deleted
  @deleted
end

#evse_idString

Standard EVSEId identifier (ISO-IEC-15118)

Returns:

  • (String)


23
24
25
# File 'lib/shell_ev/models/evse_vo.rb', line 23

def evse_id
  @evse_id
end

#external_idString

Identifier of the Evse as given by the Operator, unique for that Operator

Returns:

  • (String)


19
20
21
# File 'lib/shell_ev/models/evse_vo.rb', line 19

def external_id
  @external_id
end

#physical_referenceString

An optional number/string printed on the outside of the EVSE for visual identification

Returns:

  • (String)


48
49
50
# File 'lib/shell_ev/models/evse_vo.rb', line 48

def physical_reference
  @physical_reference
end

#statusEvseVOStatusEnum

The current status of the EVSE units availability

Returns:



27
28
29
# File 'lib/shell_ev/models/evse_vo.rb', line 27

def status
  @status
end

#uidInteger

Internal identifier used to refer to single individual EVSE unit.

Returns:

  • (Integer)


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

def uid
  @uid
end

#updatedString

ISO8601-compliant UTC datetime of the last update of the EVSE

Returns:

  • (String)


39
40
41
# File 'lib/shell_ev/models/evse_vo.rb', line 39

def updated
  @updated
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
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
128
129
130
131
132
133
134
135
136
# File 'lib/shell_ev/models/evse_vo.rb', line 101

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
  evse_id = hash.key?('evseId') ? hash['evseId'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  # Parameter is an array, so we need to iterate through it
  connectors = nil
  unless hash['connectors'].nil?
    connectors = []
    hash['connectors'].each do |structure|
      connectors << (ConnectorVO.from_hash(structure) if structure)
    end
  end

  connectors = SKIP unless hash.key?('connectors')
  authorization_methods =
    hash.key?('authorizationMethods') ? hash['authorizationMethods'] : SKIP
  updated = hash.key?('updated') ? hash['updated'] : SKIP
  deleted = hash.key?('deleted') ? hash['deleted'] : SKIP
  physical_reference =
    hash.key?('physicalReference') ? hash['physicalReference'] : SKIP

  # Create object from extracted values.
  EvseVO.new(uid,
             external_id,
             evse_id,
             status,
             connectors,
             authorization_methods,
             updated,
             deleted,
             physical_reference)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['external_id'] = 'externalId'
  @_hash['evse_id'] = 'evseId'
  @_hash['status'] = 'status'
  @_hash['connectors'] = 'connectors'
  @_hash['authorization_methods'] = 'authorizationMethods'
  @_hash['updated'] = 'updated'
  @_hash['deleted'] = 'deleted'
  @_hash['physical_reference'] = 'physicalReference'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/shell_ev/models/evse_vo.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    uid
    external_id
    evse_id
    status
    connectors
    authorization_methods
    updated
    deleted
    physical_reference
  ]
end