Class: ShellEv::LocationResponeObject

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

Overview

LocationResponeObject Model.

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, 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

#accessibilityAccessibility

Accessibility of the Location

Returns:



36
37
38
# File 'lib/shell_ev/models/location_respone_object.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.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.rb', line 24

def coordinates
  @coordinates
end

#evsesArray[EvseVO]

Accessibility of the Location

Returns:



40
41
42
# File 'lib/shell_ev/models/location_respone_object.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.rb', line 20

def external_id
  @external_id
end

#location_typeString

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

Returns:

  • (String)


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

def location_type
  @location_type
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.rb', line 45

def opening_hours
  @opening_hours
end

#operator_commentString

optional Operator-wide arbitrary text (eg promotional, warning)

Returns:

  • (String)


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

def operator_comment
  @operator_comment
end

#operator_nameString

Operator of this Shell Recharge Location

Returns:

  • (String)


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

def operator_name
  @operator_name
end

#uidInteger

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

Returns:

  • (Integer)


15
16
17
# File 'lib/shell_ev/models/location_respone_object.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.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

.namesObject

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

.nullablesObject

An array for nullable fields



94
95
96
# File 'lib/shell_ev/models/location_respone_object.rb', line 94

def self.nullables
  []
end

.optionalsObject

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