Class: ShellEv::LocationResponeObjectV2

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

Overview

LocationResponeObjectV2 Model.

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, coordinates = SKIP, operator_name = SKIP, address = SKIP, accessibility = SKIP, evses = SKIP, opening_hours = SKIP, updated = SKIP, location_type = SKIP, operator_id = SKIP, open_twenty_four_seven = SKIP) ⇒ LocationResponeObjectV2

Returns a new instance of LocationResponeObjectV2.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 104

def initialize(uid = SKIP, external_id = SKIP, coordinates = SKIP,
               operator_name = SKIP, address = SKIP, accessibility = SKIP,
               evses = SKIP, opening_hours = SKIP, updated = SKIP,
               location_type = SKIP, operator_id = SKIP,
               open_twenty_four_seven = SKIP)
  @uid = uid unless uid == SKIP
  @external_id = external_id unless external_id == SKIP
  @coordinates = coordinates unless coordinates == SKIP
  @operator_name = operator_name unless operator_name == SKIP
  @address = address unless address == SKIP
  @accessibility = accessibility unless accessibility == SKIP
  @evses = evses unless evses == SKIP
  @opening_hours = opening_hours unless opening_hours == SKIP
  @updated = updated unless updated == SKIP
  @location_type = location_type unless location_type == SKIP
  @operator_id = operator_id unless operator_id == SKIP
  @open_twenty_four_seven = open_twenty_four_seven unless open_twenty_four_seven == SKIP
end

Instance Attribute Details

#accessibilityAccessibilityV2

Accessibility of the Location

Returns:



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

def accessibility
  @accessibility
end

#addressAddress

Address of the Shell Recharge Location

Returns:



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

def address
  @address
end

#coordinatesCoordinates

Coordinates of the Shell Recharge Site Location

Returns:



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

def coordinates
  @coordinates
end

#evsesArray[EvseV2]

Accessibility of the Location

Returns:



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

def evses
  @evses
end

#external_idString

Identifier as given by the Shell Recharge Operator, unique for that Operator

Returns:

  • (String)


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

def external_id
  @external_id
end

#location_typeString

the type of the location. Could be “UNKNOWN”.

Returns:

  • (String)


53
54
55
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 53

def location_type
  @location_type
end

#open_twenty_four_sevenTrueClass | FalseClass

Whether the location is open 24/7

Returns:

  • (TrueClass | FalseClass)


61
62
63
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 61

def open_twenty_four_seven
  @open_twenty_four_seven
end

#opening_hoursArray[OpeningHoursObject]

Optional Opening Hours of the Location. Please note that it is not available for all sites.

Returns:



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

def opening_hours
  @opening_hours
end

#operator_idString

Unique Id of the operator

Returns:

  • (String)


57
58
59
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 57

def operator_id
  @operator_id
end

#operator_nameString

Operator of this Shell Recharge Location

Returns:

  • (String)


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

def operator_name
  @operator_name
end

#uidString

Unique Internal identifier used to refer to this Location by Shell Recharge

Returns:

  • (String)


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

def uid
  @uid
end

#updatedString

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

Returns:

  • (String)


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

def updated
  @updated
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 124

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
  coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
  operator_name = hash.key?('operatorName') ? hash['operatorName'] : SKIP
  address = Address.from_hash(hash['address']) if hash['address']
  accessibility = AccessibilityV2.from_hash(hash['accessibility']) if hash['accessibility']
  # Parameter is an array, so we need to iterate through it
  evses = nil
  unless hash['evses'].nil?
    evses = []
    hash['evses'].each do |structure|
      evses << (EvseV2.from_hash(structure) if structure)
    end
  end

  evses = SKIP unless hash.key?('evses')
  # Parameter is an array, so we need to iterate through it
  opening_hours = nil
  unless hash['openingHours'].nil?
    opening_hours = []
    hash['openingHours'].each do |structure|
      opening_hours << (OpeningHoursObject.from_hash(structure) if structure)
    end
  end

  opening_hours = SKIP unless hash.key?('openingHours')
  updated = hash.key?('updated') ? hash['updated'] : SKIP
  location_type = hash.key?('locationType') ? hash['locationType'] : SKIP
  operator_id = hash.key?('operatorId') ? hash['operatorId'] : SKIP
  open_twenty_four_seven =
    hash.key?('openTwentyFourSeven') ? hash['openTwentyFourSeven'] : SKIP

  # Create object from extracted values.
  LocationResponeObjectV2.new(uid,
                              external_id,
                              coordinates,
                              operator_name,
                              address,
                              accessibility,
                              evses,
                              opening_hours,
                              updated,
                              location_type,
                              operator_id,
                              open_twenty_four_seven)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['external_id'] = 'externalId'
  @_hash['coordinates'] = 'coordinates'
  @_hash['operator_name'] = 'operatorName'
  @_hash['address'] = 'address'
  @_hash['accessibility'] = 'accessibility'
  @_hash['evses'] = 'evses'
  @_hash['opening_hours'] = 'openingHours'
  @_hash['updated'] = 'updated'
  @_hash['location_type'] = 'locationType'
  @_hash['operator_id'] = 'operatorId'
  @_hash['open_twenty_four_seven'] = 'openTwentyFourSeven'
  @_hash
end

.nullablesObject

An array for nullable fields



100
101
102
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 100

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    uid
    external_id
    coordinates
    operator_name
    address
    accessibility
    evses
    opening_hours
    updated
    location_type
    operator_id
    open_twenty_four_seven
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



186
187
188
189
190
191
192
193
194
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 186

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} uid: #{@uid.inspect}, external_id: #{@external_id.inspect}, coordinates:"\
  " #{@coordinates.inspect}, operator_name: #{@operator_name.inspect}, address:"\
  " #{@address.inspect}, accessibility: #{@accessibility.inspect}, evses: #{@evses.inspect},"\
  " opening_hours: #{@opening_hours.inspect}, updated: #{@updated.inspect}, location_type:"\
  " #{@location_type.inspect}, operator_id: #{@operator_id.inspect}, open_twenty_four_seven:"\
  " #{@open_twenty_four_seven.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



176
177
178
179
180
181
182
183
# File 'lib/shell_ev/models/location_respone_object_v2.rb', line 176

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} uid: #{@uid}, external_id: #{@external_id}, coordinates: #{@coordinates},"\
  " operator_name: #{@operator_name}, address: #{@address}, accessibility: #{@accessibility},"\
  " evses: #{@evses}, opening_hours: #{@opening_hours}, updated: #{@updated}, location_type:"\
  " #{@location_type}, operator_id: #{@operator_id}, open_twenty_four_seven:"\
  " #{@open_twenty_four_seven}>"
end