Class: ShellEv::EvseV2

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

#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, evse_id = SKIP, status = SKIP, updated = SKIP, physical_reference = SKIP, connectors = SKIP, authorization_methods = SKIP) ⇒ EvseV2

Returns a new instance of EvseV2.



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/shell_ev/models/evse_v2.rb', line 79

def initialize(uid = SKIP, external_id = SKIP, evse_id = SKIP,
               status = SKIP, updated = SKIP, physical_reference = SKIP,
               connectors = SKIP, authorization_methods = 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
  @updated = updated unless updated == SKIP
  @physical_reference = physical_reference unless physical_reference == SKIP
  @connectors = connectors unless connectors == SKIP
  @authorization_methods = authorization_methods unless authorization_methods == SKIP
end

Instance Attribute Details

#authorization_methodsArray[SingleLocationMarkerAuthorizationMethodsItemsEnum]

Methods that can be used to Authorize sessions on this EVSE



44
45
46
# File 'lib/shell_ev/models/evse_v2.rb', line 44

def authorization_methods
  @authorization_methods
end

#connectorsArray[ConnectorV2]

List of all connectors available on this EVSE unit.

Returns:



40
41
42
# File 'lib/shell_ev/models/evse_v2.rb', line 40

def connectors
  @connectors
end

#evse_idString

Standard EVSEId identifier (ISO-IEC-15118)

Returns:

  • (String)


23
24
25
# File 'lib/shell_ev/models/evse_v2.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_v2.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)


36
37
38
# File 'lib/shell_ev/models/evse_v2.rb', line 36

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_v2.rb', line 27

def status
  @status
end

#uidString

Internal identifier used to refer to single individual EVSE unit.

Returns:

  • (String)


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

def uid
  @uid
end

#updatedString

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

Returns:

  • (String)


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

def updated
  @updated
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
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
# File 'lib/shell_ev/models/evse_v2.rb', line 93

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
  updated = hash.key?('updated') ? hash['updated'] : SKIP
  physical_reference =
    hash.key?('physicalReference') ? hash['physicalReference'] : 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 << (ConnectorV2.from_hash(structure) if structure)
    end
  end

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

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

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/shell_ev/models/evse_v2.rb', line 47

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

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/shell_ev/models/evse_v2.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/shell_ev/models/evse_v2.rb', line 61

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/shell_ev/models/evse_v2.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} uid: #{@uid.inspect}, external_id: #{@external_id.inspect}, evse_id:"\
  " #{@evse_id.inspect}, status: #{@status.inspect}, updated: #{@updated.inspect},"\
  " physical_reference: #{@physical_reference.inspect}, connectors: #{@connectors.inspect},"\
  " authorization_methods: #{@authorization_methods.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
# File 'lib/shell_ev/models/evse_v2.rb', line 129

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} uid: #{@uid}, external_id: #{@external_id}, evse_id: #{@evse_id}, status:"\
  " #{@status}, updated: #{@updated}, physical_reference: #{@physical_reference}, connectors:"\
  " #{@connectors}, authorization_methods: #{@authorization_methods}>"
end