Class: ShellEv::SingleLocationMarkerV2

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

Overview

A Marker is a place on the map that represent a single Location

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(status = SKIP, coordinates = SKIP, evse_count = SKIP, max_power = SKIP, location_count = SKIP, location_uid = SKIP, authorization_methods = SKIP, operator_name = SKIP) ⇒ SingleLocationMarkerV2

Returns a new instance of SingleLocationMarkerV2.



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

def initialize(status = SKIP, coordinates = SKIP, evse_count = SKIP,
               max_power = SKIP, location_count = SKIP, location_uid = SKIP,
               authorization_methods = SKIP, operator_name = SKIP)
  @status = status unless status == SKIP
  @coordinates = coordinates unless coordinates == SKIP
  @evse_count = evse_count unless evse_count == SKIP
  @max_power = max_power unless max_power == SKIP
  @location_count = location_count unless location_count == SKIP
  @location_uid = location_uid unless location_uid == SKIP
  @authorization_methods = authorization_methods unless authorization_methods == SKIP
  @operator_name = operator_name unless operator_name == SKIP
  @marker_type = 'SingleLocation'
end

Instance Attribute Details

#authorization_methodsArray[SingleLocationMarkerAuthorizationMethodsItemsEnum]

Methods that can be used to Authorize sessions on this EVSE



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

def authorization_methods
  @authorization_methods
end

#coordinatesCoordinates

Coordinates of the Shell Recharge Site Location

Returns:



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

def coordinates
  @coordinates
end

#evse_countFloat

Total number of Evse units in Locations that this Marker represents

Returns:

  • (Float)


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

def evse_count
  @evse_count
end

#location_countFloat

Number of Locations that this Marker represents in the given set of bounds

Returns:

  • (Float)


32
33
34
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 32

def location_count
  @location_count
end

#location_uidString

Unique ID of the Location this Marker represents

Returns:

  • (String)


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

def location_uid
  @location_uid
end

#marker_typeString (readonly)

Type of the Marker, in this case it will always be SingleLocation

Returns:

  • (String)


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

def marker_type
  @marker_type
end

#max_powerFloat

Maximum power in kW across all locations grouped in this marker (disregarding availability)

Returns:

  • (Float)


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

def max_power
  @max_power
end

#operator_nameString

Operator of this Shell Recharge Location

Returns:

  • (String)


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

def operator_name
  @operator_name
end

#statusSingleLocationMarkerStatusEnum

Minimum of all status values in the Marker, e.g. if at least one Evse in the Marker is available, the value will be available



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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
  evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
  max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
  location_count = hash.key?('locationCount') ? hash['locationCount'] : SKIP
  location_uid = hash.key?('locationUid') ? hash['locationUid'] : SKIP
  authorization_methods =
    hash.key?('authorizationMethods') ? hash['authorizationMethods'] : SKIP
  operator_name = hash.key?('operatorName') ? hash['operatorName'] : SKIP

  # Create object from extracted values.
  SingleLocationMarkerV2.new(status,
                             coordinates,
                             evse_count,
                             max_power,
                             location_count,
                             location_uid,
                             authorization_methods,
                             operator_name)
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/single_location_marker_v2.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['coordinates'] = 'coordinates'
  @_hash['evse_count'] = 'evseCount'
  @_hash['max_power'] = 'maxPower'
  @_hash['location_count'] = 'locationCount'
  @_hash['location_uid'] = 'locationUid'
  @_hash['authorization_methods'] = 'authorizationMethods'
  @_hash['operator_name'] = 'operatorName'
  @_hash['marker_type'] = 'markerType'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    status
    coordinates
    evse_count
    max_power
    location_count
    location_uid
    authorization_methods
    operator_name
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



126
127
128
129
130
131
132
133
134
135
136
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 126

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.marker_type,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['markerType'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, coordinates: #{@coordinates.inspect},"\
  " evse_count: #{@evse_count.inspect}, max_power: #{@max_power.inspect}, location_count:"\
  " #{@location_count.inspect}, location_uid: #{@location_uid.inspect}, authorization_methods:"\
  " #{@authorization_methods.inspect}, operator_name: #{@operator_name.inspect}, marker_type:"\
  " #{@marker_type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



139
140
141
142
143
144
145
# File 'lib/shell_ev/models/single_location_marker_v2.rb', line 139

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, coordinates: #{@coordinates}, evse_count:"\
  " #{@evse_count}, max_power: #{@max_power}, location_count: #{@location_count},"\
  " location_uid: #{@location_uid}, authorization_methods: #{@authorization_methods},"\
  " operator_name: #{@operator_name}, marker_type: #{@marker_type}>"
end