ev-recharge-sdk 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +91 -25
  4. data/bin/console +15 -0
  5. data/lib/shell_ev/api_helper.rb +2 -2
  6. data/lib/shell_ev/client.rb +15 -4
  7. data/lib/shell_ev/configuration.rb +88 -15
  8. data/lib/shell_ev/controllers/base_controller.rb +3 -9
  9. data/lib/shell_ev/controllers/charging_controller.rb +19 -18
  10. data/lib/shell_ev/controllers/locations_controller.rb +48 -50
  11. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +5 -5
  12. data/lib/shell_ev/exceptions/api_exception.rb +13 -2
  13. data/lib/shell_ev/exceptions/bad_request_exception.rb +20 -5
  14. data/lib/shell_ev/exceptions/internal_server_error_exception.rb +21 -5
  15. data/lib/shell_ev/exceptions/not_found_exception.rb +20 -5
  16. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +21 -5
  17. data/lib/shell_ev/exceptions/serviceunavailable_exception.rb +20 -5
  18. data/lib/shell_ev/exceptions/too_many_requests_exception.rb +20 -5
  19. data/lib/shell_ev/exceptions/unauthorized_exception.rb +20 -5
  20. data/lib/shell_ev/exceptions/v2_charge_session_retrieve404_error_exception.rb +67 -0
  21. data/lib/shell_ev/exceptions/v2_charge_session_start404_error_exception.rb +67 -0
  22. data/lib/shell_ev/exceptions/v2_charge_session_stop404_error_exception.rb +67 -0
  23. data/lib/shell_ev/http/auth/o_auth2.rb +18 -3
  24. data/lib/shell_ev/http/http_call_back.rb +2 -2
  25. data/lib/shell_ev/http/http_method_enum.rb +2 -2
  26. data/lib/shell_ev/http/http_request.rb +2 -2
  27. data/lib/shell_ev/http/http_response.rb +2 -2
  28. data/lib/shell_ev/http/proxy_settings.rb +22 -0
  29. data/lib/shell_ev/models/accessibility_status_enum.rb +17 -2
  30. data/lib/shell_ev/models/{accessibility.rb → accessibility_v2.rb} +17 -14
  31. data/lib/shell_ev/models/active_response200_json.rb +15 -2
  32. data/lib/shell_ev/models/active_response200_json_status_enum.rb +15 -2
  33. data/lib/shell_ev/models/address.rb +16 -2
  34. data/lib/shell_ev/models/bad_request_err_msg.rb +16 -2
  35. data/lib/shell_ev/models/base_model.rb +2 -2
  36. data/lib/shell_ev/models/charge_error.rb +14 -2
  37. data/lib/shell_ev/models/charge_retrieve_state.rb +14 -2
  38. data/lib/shell_ev/models/chargesession_start_body.rb +15 -2
  39. data/lib/shell_ev/models/connector_types_enum.rb +100 -0
  40. data/lib/shell_ev/models/connector_v2.rb +95 -0
  41. data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +31 -2
  42. data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +17 -2
  43. data/lib/shell_ev/models/coordinates.rb +14 -2
  44. data/lib/shell_ev/models/coordinates1.rb +81 -0
  45. data/lib/shell_ev/models/data_active.rb +19 -2
  46. data/lib/shell_ev/models/data_retrieve.rb +19 -2
  47. data/lib/shell_ev/models/day_of_week_enum.rb +56 -0
  48. data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +16 -2
  49. data/lib/shell_ev/models/{electrical_properties.rb → electrical_properties_v2.rb} +22 -8
  50. data/lib/shell_ev/models/evse_status_enum.rb +44 -0
  51. data/lib/shell_ev/models/{evse_vo.rb → evse_v2.rb} +45 -38
  52. data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +16 -2
  53. data/lib/shell_ev/models/evse_vo_status_enum.rb +17 -2
  54. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +15 -2
  55. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +15 -2
  56. data/lib/shell_ev/models/get_ev_locations_authorization_methods_enum.rb +16 -2
  57. data/lib/shell_ev/models/get_ev_locations_connector_types_enum.rb +31 -2
  58. data/lib/shell_ev/models/get_ev_locations_evse_status_enum.rb +17 -2
  59. data/lib/shell_ev/models/inline_response202.rb +17 -6
  60. data/lib/shell_ev/models/inline_response2021.rb +14 -2
  61. data/lib/shell_ev/models/inline_response2021_status_enum.rb +15 -2
  62. data/lib/shell_ev/models/inline_response202_data.rb +14 -2
  63. data/lib/shell_ev/models/inline_response202_status_enum.rb +15 -2
  64. data/lib/shell_ev/models/internal_error_object.rb +15 -2
  65. data/lib/shell_ev/models/{location_respone_object.rb → location_respone_object_v2.rb} +61 -30
  66. data/lib/shell_ev/models/locations_markers_authorization_methods_enum.rb +16 -2
  67. data/lib/shell_ev/models/locations_markers_connector_types_enum.rb +31 -2
  68. data/lib/shell_ev/models/locations_markers_evse_status_enum.rb +17 -2
  69. data/lib/shell_ev/models/multi_location_marker.rb +22 -5
  70. data/lib/shell_ev/models/multi_location_marker_v2.rb +126 -0
  71. data/lib/shell_ev/models/nearby_locations_authorization_methods_enum.rb +16 -2
  72. data/lib/shell_ev/models/nearby_locations_connector_types_enum.rb +31 -2
  73. data/lib/shell_ev/models/nearby_locations_evse_status_enum.rb +17 -2
  74. data/lib/shell_ev/models/not_found_err_msg.rb +16 -2
  75. data/lib/shell_ev/models/o_auth_provider_error_enum.rb +19 -2
  76. data/lib/shell_ev/models/o_auth_token.rb +2 -2
  77. data/lib/shell_ev/models/opening_hours_object.rb +17 -3
  78. data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +20 -2
  79. data/lib/shell_ev/models/power_range.rb +68 -0
  80. data/lib/shell_ev/models/price_component.rb +86 -0
  81. data/lib/shell_ev/models/ratelimit_err_msg.rb +16 -2
  82. data/lib/shell_ev/models/{response.rb → response_v2.rb} +22 -9
  83. data/lib/shell_ev/models/restrictions.rb +183 -0
  84. data/lib/shell_ev/models/search_by_id_connector.rb +115 -0
  85. data/lib/shell_ev/models/search_by_id_evse.rb +145 -0
  86. data/lib/shell_ev/models/search_by_id_location_respone.rb +196 -0
  87. data/lib/shell_ev/models/search_by_id_response.rb +91 -0
  88. data/lib/shell_ev/models/serviceunavailable_err_msg.rb +16 -2
  89. data/lib/shell_ev/models/single_location_marker.rb +27 -6
  90. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +16 -2
  91. data/lib/shell_ev/models/single_location_marker_response.rb +15 -2
  92. data/lib/shell_ev/models/single_location_marker_response_v2.rb +94 -0
  93. data/lib/shell_ev/models/single_location_marker_status_enum.rb +17 -2
  94. data/lib/shell_ev/models/single_location_marker_v2.rb +157 -0
  95. data/lib/shell_ev/models/tariff.rb +20 -3
  96. data/lib/shell_ev/models/tariff_alt_text.rb +68 -0
  97. data/lib/shell_ev/models/tariff_element.rb +80 -0
  98. data/lib/shell_ev/models/tariff_type_enum.rb +44 -0
  99. data/lib/shell_ev/models/tariff_v2.rb +226 -0
  100. data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +17 -2
  101. data/lib/shell_ev/models/type_enum.rb +44 -0
  102. data/lib/shell_ev/models/unauthorized_err_msg.rb +16 -2
  103. data/lib/shell_ev/utilities/date_time_helper.rb +2 -2
  104. data/lib/shell_ev/utilities/file_wrapper.rb +16 -4
  105. data/lib/shell_ev/utilities/union_type_lookup.rb +19 -2
  106. data/lib/shell_ev.rb +34 -10
  107. data/test/controllers/controller_test_base.rb +5 -10
  108. data/test/controllers/test_charging_controller.rb +7 -11
  109. data/test/controllers/test_locations_controller.rb +8 -11
  110. data/test/http_response_catcher.rb +3 -3
  111. metadata +38 -15
  112. data/lib/shell_ev/models/connector_vo.rb +0 -131
  113. data/lib/shell_ev/models/tariff_vo.rb +0 -107
@@ -1,17 +1,17 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
- # LocationResponeObject Model.
8
- class LocationResponeObject < BaseModel
7
+ # LocationResponeObjectV2 Model.
8
+ class LocationResponeObjectV2 < BaseModel
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
12
  # Unique Internal identifier used to refer to this Location by Shell
13
13
  # Recharge
14
- # @return [Integer]
14
+ # @return [String]
15
15
  attr_accessor :uid
16
16
 
17
17
  # Identifier as given by the Shell Recharge Operator, unique for that
@@ -32,11 +32,11 @@ module ShellEv
32
32
  attr_accessor :address
33
33
 
34
34
  # Accessibility of the Location
35
- # @return [Accessibility]
35
+ # @return [AccessibilityV2]
36
36
  attr_accessor :accessibility
37
37
 
38
38
  # Accessibility of the Location
39
- # @return [Array[EvseVO]]
39
+ # @return [Array[EvseV2]]
40
40
  attr_accessor :evses
41
41
 
42
42
  # Optional Opening Hours of the Location. Please note that it is not
@@ -48,14 +48,18 @@ module ShellEv
48
48
  # @return [String]
49
49
  attr_accessor :updated
50
50
 
51
- # optional Operator-wide arbitrary text (eg promotional, warning)
52
- # @return [String]
53
- attr_accessor :operator_comment
54
-
55
51
  # the type of the location. Could be "UNKNOWN".
56
52
  # @return [String]
57
53
  attr_accessor :location_type
58
54
 
55
+ # Unique Id of the operator
56
+ # @return [String]
57
+ attr_accessor :operator_id
58
+
59
+ # Whether the location is open 24/7
60
+ # @return [TrueClass | FalseClass]
61
+ attr_accessor :open_twenty_four_seven
62
+
59
63
  # A mapping from model property names to API property names.
60
64
  def self.names
61
65
  @_hash = {} if @_hash.nil?
@@ -68,8 +72,9 @@ module ShellEv
68
72
  @_hash['evses'] = 'evses'
69
73
  @_hash['opening_hours'] = 'openingHours'
70
74
  @_hash['updated'] = 'updated'
71
- @_hash['operator_comment'] = 'operatorComment'
72
75
  @_hash['location_type'] = 'locationType'
76
+ @_hash['operator_id'] = 'operatorId'
77
+ @_hash['open_twenty_four_seven'] = 'openTwentyFourSeven'
73
78
  @_hash
74
79
  end
75
80
 
@@ -85,8 +90,9 @@ module ShellEv
85
90
  evses
86
91
  opening_hours
87
92
  updated
88
- operator_comment
89
93
  location_type
94
+ operator_id
95
+ open_twenty_four_seven
90
96
  ]
91
97
  end
92
98
 
@@ -98,7 +104,8 @@ module ShellEv
98
104
  def initialize(uid = SKIP, external_id = SKIP, coordinates = SKIP,
99
105
  operator_name = SKIP, address = SKIP, accessibility = SKIP,
100
106
  evses = SKIP, opening_hours = SKIP, updated = SKIP,
101
- operator_comment = SKIP, location_type = SKIP)
107
+ location_type = SKIP, operator_id = SKIP,
108
+ open_twenty_four_seven = SKIP)
102
109
  @uid = uid unless uid == SKIP
103
110
  @external_id = external_id unless external_id == SKIP
104
111
  @coordinates = coordinates unless coordinates == SKIP
@@ -108,8 +115,9 @@ module ShellEv
108
115
  @evses = evses unless evses == SKIP
109
116
  @opening_hours = opening_hours unless opening_hours == SKIP
110
117
  @updated = updated unless updated == SKIP
111
- @operator_comment = operator_comment unless operator_comment == SKIP
112
118
  @location_type = location_type unless location_type == SKIP
119
+ @operator_id = operator_id unless operator_id == SKIP
120
+ @open_twenty_four_seven = open_twenty_four_seven unless open_twenty_four_seven == SKIP
113
121
  end
114
122
 
115
123
  # Creates an instance of the object from a hash.
@@ -122,13 +130,13 @@ module ShellEv
122
130
  coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
123
131
  operator_name = hash.key?('operatorName') ? hash['operatorName'] : SKIP
124
132
  address = Address.from_hash(hash['address']) if hash['address']
125
- accessibility = Accessibility.from_hash(hash['accessibility']) if hash['accessibility']
133
+ accessibility = AccessibilityV2.from_hash(hash['accessibility']) if hash['accessibility']
126
134
  # Parameter is an array, so we need to iterate through it
127
135
  evses = nil
128
136
  unless hash['evses'].nil?
129
137
  evses = []
130
138
  hash['evses'].each do |structure|
131
- evses << (EvseVO.from_hash(structure) if structure)
139
+ evses << (EvseV2.from_hash(structure) if structure)
132
140
  end
133
141
  end
134
142
 
@@ -144,22 +152,45 @@ module ShellEv
144
152
 
145
153
  opening_hours = SKIP unless hash.key?('openingHours')
146
154
  updated = hash.key?('updated') ? hash['updated'] : SKIP
147
- operator_comment =
148
- hash.key?('operatorComment') ? hash['operatorComment'] : SKIP
149
155
  location_type = hash.key?('locationType') ? hash['locationType'] : SKIP
156
+ operator_id = hash.key?('operatorId') ? hash['operatorId'] : SKIP
157
+ open_twenty_four_seven =
158
+ hash.key?('openTwentyFourSeven') ? hash['openTwentyFourSeven'] : SKIP
150
159
 
151
160
  # Create object from extracted values.
152
- LocationResponeObject.new(uid,
153
- external_id,
154
- coordinates,
155
- operator_name,
156
- address,
157
- accessibility,
158
- evses,
159
- opening_hours,
160
- updated,
161
- operator_comment,
162
- location_type)
161
+ LocationResponeObjectV2.new(uid,
162
+ external_id,
163
+ coordinates,
164
+ operator_name,
165
+ address,
166
+ accessibility,
167
+ evses,
168
+ opening_hours,
169
+ updated,
170
+ location_type,
171
+ operator_id,
172
+ open_twenty_four_seven)
173
+ end
174
+
175
+ # Provides a human-readable string representation of the object.
176
+ def to_s
177
+ class_name = self.class.name.split('::').last
178
+ "<#{class_name} uid: #{@uid}, external_id: #{@external_id}, coordinates: #{@coordinates},"\
179
+ " operator_name: #{@operator_name}, address: #{@address}, accessibility: #{@accessibility},"\
180
+ " evses: #{@evses}, opening_hours: #{@opening_hours}, updated: #{@updated}, location_type:"\
181
+ " #{@location_type}, operator_id: #{@operator_id}, open_twenty_four_seven:"\
182
+ " #{@open_twenty_four_seven}>"
183
+ end
184
+
185
+ # Provides a debugging-friendly string with detailed object information.
186
+ def inspect
187
+ class_name = self.class.name.split('::').last
188
+ "<#{class_name} uid: #{@uid.inspect}, external_id: #{@external_id.inspect}, coordinates:"\
189
+ " #{@coordinates.inspect}, operator_name: #{@operator_name.inspect}, address:"\
190
+ " #{@address.inspect}, accessibility: #{@accessibility.inspect}, evses: #{@evses.inspect},"\
191
+ " opening_hours: #{@opening_hours.inspect}, updated: #{@updated.inspect}, location_type:"\
192
+ " #{@location_type.inspect}, operator_id: #{@operator_id.inspect}, open_twenty_four_seven:"\
193
+ " #{@open_twenty_four_seven.inspect}>"
163
194
  end
164
195
  end
165
196
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that support the given Authorization Methods
@@ -22,5 +22,19 @@ module ShellEv
22
22
 
23
23
  LOCATIONS_MARKERS_AUTHORIZATION_METHODS_ENUM.include?(value)
24
24
  end
25
+
26
+ def self.from_value(value, default_value = NEWMOTIONAPP)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'newmotionapp' then NEWMOTIONAPP
33
+ when 'rfidtoken' then RFIDTOKEN
34
+ when 'pnc' then PNC
35
+ else
36
+ default_value
37
+ end
38
+ end
25
39
  end
26
40
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that have Connectors with the set of Connector Types
@@ -67,5 +67,34 @@ module ShellEv
67
67
 
68
68
  LOCATIONS_MARKERS_CONNECTOR_TYPES_ENUM.include?(value)
69
69
  end
70
+
71
+ def self.from_value(value, default_value = AVCON)
72
+ return default_value if value.nil?
73
+
74
+ str = value.to_s.strip
75
+
76
+ case str.downcase
77
+ when 'avcon' then AVCON
78
+ when 'domestic' then DOMESTIC
79
+ when 'industrial2pdc' then INDUSTRIAL2PDC
80
+ when 'industrialpneac' then INDUSTRIALPNEAC
81
+ when 'industrial3peac' then INDUSTRIAL3PEAC
82
+ when 'industrial3penac' then INDUSTRIAL3PENAC
83
+ when 'type1' then TYPE1
84
+ when 'type1combo' then TYPE1COMBO
85
+ when 'type2' then TYPE2
86
+ when 'type2combo' then TYPE2COMBO
87
+ when 'type3' then TYPE3
88
+ when 'lpi' then LPI
89
+ when 'nema520' then NEMA520
90
+ when 'saej1772' then SAEJ1772
91
+ when 'spi' then SPI
92
+ when 'tepcochademo' then TEPCOCHADEMO
93
+ when 'tesla' then TESLA
94
+ when 'unspecified' then UNSPECIFIED
95
+ else
96
+ default_value
97
+ end
98
+ end
70
99
  end
71
100
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that have the given status
@@ -25,5 +25,20 @@ module ShellEv
25
25
 
26
26
  LOCATIONS_MARKERS_EVSE_STATUS_ENUM.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = AVAILABLE)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'available' then AVAILABLE
36
+ when 'occupied' then OCCUPIED
37
+ when 'unavailable' then UNAVAILABLE
38
+ when 'unknown' then UNKNOWN
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # A Marker is a place on the map that represent multiple Locations at the same
@@ -19,8 +19,8 @@ module ShellEv
19
19
  # @return [String]
20
20
  attr_accessor :unique_key
21
21
 
22
- # Coordinates of the Shell Recharge Site Location
23
- # @return [Coordinates]
22
+ # Uniquely identifies the marker object
23
+ # @return [Coordinates1]
24
24
  attr_accessor :coordinates
25
25
 
26
26
  # Number of Locations that this Marker represents in the given set of bounds
@@ -89,7 +89,7 @@ module ShellEv
89
89
  # Extract variables from the hash.
90
90
  marker_type = hash.key?('markerType') ? hash['markerType'] : nil
91
91
  unique_key = hash.key?('uniqueKey') ? hash['uniqueKey'] : SKIP
92
- coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
92
+ coordinates = Coordinates1.from_hash(hash['coordinates']) if hash['coordinates']
93
93
  location_count = hash.key?('locationCount') ? hash['locationCount'] : SKIP
94
94
  evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
95
95
  max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
@@ -118,5 +118,22 @@ module ShellEv
118
118
  APIHelper.valid_type?(value['markerType'],
119
119
  ->(val) { val.instance_of? String })
120
120
  end
121
+
122
+ # Provides a human-readable string representation of the object.
123
+ def to_s
124
+ class_name = self.class.name.split('::').last
125
+ "<#{class_name} marker_type: #{@marker_type}, unique_key: #{@unique_key}, coordinates:"\
126
+ " #{@coordinates}, location_count: #{@location_count}, evse_count: #{@evse_count},"\
127
+ " max_power: #{@max_power}, geo_hash: #{@geo_hash}>"
128
+ end
129
+
130
+ # Provides a debugging-friendly string with detailed object information.
131
+ def inspect
132
+ class_name = self.class.name.split('::').last
133
+ "<#{class_name} marker_type: #{@marker_type.inspect}, unique_key: #{@unique_key.inspect},"\
134
+ " coordinates: #{@coordinates.inspect}, location_count: #{@location_count.inspect},"\
135
+ " evse_count: #{@evse_count.inspect}, max_power: #{@max_power.inspect}, geo_hash:"\
136
+ " #{@geo_hash.inspect}>"
137
+ end
121
138
  end
122
139
  end
@@ -0,0 +1,126 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ShellEv
7
+ # A Marker is a place on the map that represent multiple Locations at the same
8
+ # spot
9
+ class MultiLocationMarkerV2 < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Coordinates of the Shell Recharge Site Location
14
+ # @return [Coordinates]
15
+ attr_accessor :coordinates
16
+
17
+ # Number of Locations that this Marker represents in the given set of bounds
18
+ # @return [Float]
19
+ attr_accessor :location_count
20
+
21
+ # Total number of Evses in Locations that this Marker represents
22
+ # @return [Float]
23
+ attr_accessor :evse_count
24
+
25
+ # Maximum power in kW across all locations grouped in this marker
26
+ # (disregarding availability)
27
+ # @return [Float]
28
+ attr_accessor :max_power
29
+
30
+ # Operator of this Shell Recharge Location
31
+ # @return [String]
32
+ attr_accessor :operator_name
33
+
34
+ # Type of the Marker, in this case it will always be MultiLocation
35
+ # @return [String]
36
+ attr_reader :marker_type
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['coordinates'] = 'coordinates'
42
+ @_hash['location_count'] = 'locationCount'
43
+ @_hash['evse_count'] = 'evseCount'
44
+ @_hash['max_power'] = 'maxPower'
45
+ @_hash['operator_name'] = 'operatorName'
46
+ @_hash['marker_type'] = 'markerType'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ coordinates
54
+ location_count
55
+ evse_count
56
+ max_power
57
+ operator_name
58
+ ]
59
+ end
60
+
61
+ # An array for nullable fields
62
+ def self.nullables
63
+ []
64
+ end
65
+
66
+ def initialize(coordinates = SKIP, location_count = SKIP, evse_count = SKIP,
67
+ max_power = SKIP, operator_name = SKIP)
68
+ @coordinates = coordinates unless coordinates == SKIP
69
+ @location_count = location_count unless location_count == SKIP
70
+ @evse_count = evse_count unless evse_count == SKIP
71
+ @max_power = max_power unless max_power == SKIP
72
+ @operator_name = operator_name unless operator_name == SKIP
73
+ @marker_type = 'MultiLocation'
74
+ end
75
+
76
+ # Creates an instance of the object from a hash.
77
+ def self.from_hash(hash)
78
+ return nil unless hash
79
+
80
+ # Extract variables from the hash.
81
+ coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
82
+ location_count = hash.key?('locationCount') ? hash['locationCount'] : SKIP
83
+ evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
84
+ max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
85
+ operator_name = hash.key?('operatorName') ? hash['operatorName'] : SKIP
86
+
87
+ # Create object from extracted values.
88
+ MultiLocationMarkerV2.new(coordinates,
89
+ location_count,
90
+ evse_count,
91
+ max_power,
92
+ operator_name)
93
+ end
94
+
95
+ # Validates an instance of the object from a given value.
96
+ # @param [MultiLocationMarkerV2 | Hash] The value against the validation is performed.
97
+ def self.validate(value)
98
+ if value.instance_of? self
99
+ return APIHelper.valid_type?(value.marker_type,
100
+ ->(val) { val.instance_of? String })
101
+ end
102
+
103
+ return false unless value.instance_of? Hash
104
+
105
+ APIHelper.valid_type?(value['markerType'],
106
+ ->(val) { val.instance_of? String })
107
+ end
108
+
109
+ # Provides a human-readable string representation of the object.
110
+ def to_s
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} coordinates: #{@coordinates}, location_count: #{@location_count},"\
113
+ " evse_count: #{@evse_count}, max_power: #{@max_power}, operator_name: #{@operator_name},"\
114
+ " marker_type: #{@marker_type}>"
115
+ end
116
+
117
+ # Provides a debugging-friendly string with detailed object information.
118
+ def inspect
119
+ class_name = self.class.name.split('::').last
120
+ "<#{class_name} coordinates: #{@coordinates.inspect}, location_count:"\
121
+ " #{@location_count.inspect}, evse_count: #{@evse_count.inspect}, max_power:"\
122
+ " #{@max_power.inspect}, operator_name: #{@operator_name.inspect}, marker_type:"\
123
+ " #{@marker_type.inspect}>"
124
+ end
125
+ end
126
+ end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that support the given Authorization Methods
@@ -22,5 +22,19 @@ module ShellEv
22
22
 
23
23
  NEARBY_LOCATIONS_AUTHORIZATION_METHODS_ENUM.include?(value)
24
24
  end
25
+
26
+ def self.from_value(value, default_value = NEWMOTIONAPP)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'newmotionapp' then NEWMOTIONAPP
33
+ when 'rfidtoken' then RFIDTOKEN
34
+ when 'pnc' then PNC
35
+ else
36
+ default_value
37
+ end
38
+ end
25
39
  end
26
40
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that have Connectors with these Connector Types
@@ -67,5 +67,34 @@ module ShellEv
67
67
 
68
68
  NEARBY_LOCATIONS_CONNECTOR_TYPES_ENUM.include?(value)
69
69
  end
70
+
71
+ def self.from_value(value, default_value = AVCON)
72
+ return default_value if value.nil?
73
+
74
+ str = value.to_s.strip
75
+
76
+ case str.downcase
77
+ when 'avcon' then AVCON
78
+ when 'domestic' then DOMESTIC
79
+ when 'industrial2pdc' then INDUSTRIAL2PDC
80
+ when 'industrialpneac' then INDUSTRIALPNEAC
81
+ when 'industrial3peac' then INDUSTRIAL3PEAC
82
+ when 'industrial3penac' then INDUSTRIAL3PENAC
83
+ when 'type1' then TYPE1
84
+ when 'type1combo' then TYPE1COMBO
85
+ when 'type2' then TYPE2
86
+ when 'type2combo' then TYPE2COMBO
87
+ when 'type3' then TYPE3
88
+ when 'lpi' then LPI
89
+ when 'nema520' then NEMA520
90
+ when 'saej1772' then SAEJ1772
91
+ when 'spi' then SPI
92
+ when 'tepcochademo' then TEPCOCHADEMO
93
+ when 'tesla' then TESLA
94
+ when 'unspecified' then UNSPECIFIED
95
+ else
96
+ default_value
97
+ end
98
+ end
70
99
  end
71
100
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # Filter by Locations that have the given status
@@ -25,5 +25,20 @@ module ShellEv
25
25
 
26
26
  NEARBY_LOCATIONS_EVSE_STATUS_ENUM.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = AVAILABLE)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'available' then AVAILABLE
36
+ when 'occupied' then OCCUPIED
37
+ when 'unavailable' then UNAVAILABLE
38
+ when 'unknown' then UNKNOWN
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # NotFoundErrMsg Model.
@@ -78,5 +78,19 @@ module ShellEv
78
78
  description,
79
79
  details)
80
80
  end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} code: #{@code}, message: #{@message}, description: #{@description},"\
86
+ " details: #{@details}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}, description:"\
93
+ " #{@description.inspect}, details: #{@details.inspect}>"
94
+ end
81
95
  end
82
96
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # OAuth 2 Authorization error codes
@@ -41,5 +41,22 @@ module ShellEv
41
41
 
42
42
  O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
43
43
  end
44
+
45
+ def self.from_value(value, default_value = INVALID_REQUEST)
46
+ return default_value if value.nil?
47
+
48
+ str = value.to_s.strip
49
+
50
+ case str.downcase
51
+ when 'invalid_request' then INVALID_REQUEST
52
+ when 'invalid_client' then INVALID_CLIENT
53
+ when 'invalid_grant' then INVALID_GRANT
54
+ when 'unauthorized_client' then UNAUTHORIZED_CLIENT
55
+ when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
56
+ when 'invalid_scope' then INVALID_SCOPE
57
+ else
58
+ default_value
59
+ end
60
+ end
44
61
  end
45
62
  end
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # OAuth 2 Authorization endpoint response
@@ -1,7 +1,7 @@
1
1
  # shell_ev
2
2
  #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
5
 
6
6
  module ShellEv
7
7
  # OpeningHoursObject Model.
@@ -9,7 +9,7 @@ module ShellEv
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # TODO: Write general description for this method
12
+ # 3 letter day of the week
13
13
  # @return [OpeningHoursObjectWeekDayEnum]
14
14
  attr_accessor :week_day
15
15
 
@@ -64,5 +64,19 @@ module ShellEv
64
64
  start_time,
65
65
  end_time)
66
66
  end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} week_day: #{@week_day}, start_time: #{@start_time}, end_time:"\
72
+ " #{@end_time}>"
73
+ end
74
+
75
+ # Provides a debugging-friendly string with detailed object information.
76
+ def inspect
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} week_day: #{@week_day.inspect}, start_time: #{@start_time.inspect},"\
79
+ " end_time: #{@end_time.inspect}>"
80
+ end
67
81
  end
68
82
  end