Class: ShellEv::LocationResponeObject
- Defined in:
- lib/shell_ev/models/location_respone_object.rb
Overview
LocationResponeObject Model.
Instance Attribute Summary collapse
-
#accessibility ⇒ Accessibility
Accessibility of the Location.
-
#address ⇒ Address
Address of the Shell Recharge Location.
-
#coordinates ⇒ Coordinates
Coordinates of the Shell Recharge Site Location.
-
#evses ⇒ Array[EvseVO]
Accessibility of the Location.
-
#external_id ⇒ String
Identifier as given by the Shell Recharge Operator, unique for that Operator.
-
#location_type ⇒ String
the type of the location.
-
#opening_hours ⇒ Array[OpeningHoursObject]
Optional Opening Hours of the Location.
-
#operator_comment ⇒ String
optional Operator-wide arbitrary text (eg promotional, warning).
-
#operator_name ⇒ String
Operator of this Shell Recharge Location.
-
#uid ⇒ Integer
Unique Internal identifier used to refer to this Location by Shell Recharge.
-
#updated ⇒ String
ISO8601-compliant UTC datetime of the last update of the location.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(uid = SKIP, external_id = SKIP, coordinates = SKIP, operator_name = SKIP, address = SKIP, accessibility = SKIP, evses = SKIP, opening_hours = SKIP, updated = SKIP, operator_comment = SKIP, location_type = SKIP) ⇒ LocationResponeObject
constructor
A new instance of LocationResponeObject.
Methods inherited from BaseModel
Constructor Details
#initialize(uid = SKIP, external_id = SKIP, coordinates = SKIP, operator_name = SKIP, address = SKIP, accessibility = SKIP, evses = SKIP, opening_hours = SKIP, updated = SKIP, operator_comment = SKIP, location_type = SKIP) ⇒ LocationResponeObject
Returns a new instance of LocationResponeObject.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 98 def initialize(uid = SKIP, external_id = SKIP, coordinates = SKIP, operator_name = SKIP, address = SKIP, accessibility = SKIP, evses = SKIP, opening_hours = SKIP, updated = SKIP, operator_comment = SKIP, location_type = 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 @operator_comment = operator_comment unless operator_comment == SKIP @location_type = location_type unless location_type == SKIP end |
Instance Attribute Details
#accessibility ⇒ Accessibility
Accessibility of the Location
36 37 38 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 36 def accessibility @accessibility end |
#address ⇒ Address
Address of the Shell Recharge Location
32 33 34 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 32 def address @address end |
#coordinates ⇒ Coordinates
Coordinates of the Shell Recharge Site Location
24 25 26 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 24 def coordinates @coordinates end |
#evses ⇒ Array[EvseVO]
Accessibility of the Location
40 41 42 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 40 def evses @evses end |
#external_id ⇒ String
Identifier as given by the Shell Recharge Operator, unique for that Operator
20 21 22 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 20 def external_id @external_id end |
#location_type ⇒ String
the type of the location. Could be “UNKNOWN”.
57 58 59 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 57 def location_type @location_type end |
#opening_hours ⇒ Array[OpeningHoursObject]
Optional Opening Hours of the Location. Please note that it is not available for all sites.
45 46 47 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 45 def opening_hours @opening_hours end |
#operator_comment ⇒ String
optional Operator-wide arbitrary text (eg promotional, warning)
53 54 55 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 53 def operator_comment @operator_comment end |
#operator_name ⇒ String
Operator of this Shell Recharge Location
28 29 30 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 28 def operator_name @operator_name end |
#uid ⇒ Integer
Unique Internal identifier used to refer to this Location by Shell Recharge
15 16 17 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 15 def uid @uid end |
#updated ⇒ String
ISO8601-compliant UTC datetime of the last update of the location
49 50 51 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 49 def updated @updated end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
116 117 118 119 120 121 122 123 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 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 116 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 = Accessibility.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 << (EvseVO.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 operator_comment = hash.key?('operatorComment') ? hash['operatorComment'] : SKIP location_type = hash.key?('locationType') ? hash['locationType'] : SKIP # Create object from extracted values. LocationResponeObject.new(uid, external_id, coordinates, operator_name, address, accessibility, evses, opening_hours, updated, operator_comment, location_type) end |
.names ⇒ Object
A mapping from model property names to API property names.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 60 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['operator_comment'] = 'operatorComment' @_hash['location_type'] = 'locationType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
94 95 96 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 94 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/shell_ev/models/location_respone_object.rb', line 77 def self.optionals %w[ uid external_id coordinates operator_name address accessibility evses opening_hours updated operator_comment location_type ] end |