ev-recharge-sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +92 -0
  4. data/lib/shell_ev/api_helper.rb +10 -0
  5. data/lib/shell_ev/client.rb +77 -0
  6. data/lib/shell_ev/configuration.rb +110 -0
  7. data/lib/shell_ev/controllers/base_controller.rb +66 -0
  8. data/lib/shell_ev/controllers/charging_controller.rb +216 -0
  9. data/lib/shell_ev/controllers/locations_controller.rb +352 -0
  10. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +42 -0
  11. data/lib/shell_ev/exceptions/api_exception.rb +10 -0
  12. data/lib/shell_ev/exceptions/bad_request_exception.rb +37 -0
  13. data/lib/shell_ev/exceptions/http401_error_response_exception.rb +52 -0
  14. data/lib/shell_ev/exceptions/m400_error_response_error1_exception.rb +52 -0
  15. data/lib/shell_ev/exceptions/m401_error_response_error1_exception.rb +52 -0
  16. data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +53 -0
  17. data/lib/shell_ev/exceptions/m405_error_response_error1_exception.rb +52 -0
  18. data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +52 -0
  19. data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +52 -0
  20. data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +52 -0
  21. data/lib/shell_ev/exceptions/not_found_exception.rb +37 -0
  22. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +48 -0
  23. data/lib/shell_ev/exceptions/unauthorized_exception.rb +37 -0
  24. data/lib/shell_ev/http/auth/o_auth2.rb +90 -0
  25. data/lib/shell_ev/http/http_call_back.rb +10 -0
  26. data/lib/shell_ev/http/http_method_enum.rb +10 -0
  27. data/lib/shell_ev/http/http_request.rb +10 -0
  28. data/lib/shell_ev/http/http_response.rb +10 -0
  29. data/lib/shell_ev/models/accessibility.rb +60 -0
  30. data/lib/shell_ev/models/accessibility_status_enum.rb +29 -0
  31. data/lib/shell_ev/models/active_response200_json.rb +78 -0
  32. data/lib/shell_ev/models/active_response200_json_status_enum.rb +23 -0
  33. data/lib/shell_ev/models/address.rb +81 -0
  34. data/lib/shell_ev/models/base_model.rb +62 -0
  35. data/lib/shell_ev/models/chargesession_start_body.rb +59 -0
  36. data/lib/shell_ev/models/connector_vo.rb +134 -0
  37. data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +71 -0
  38. data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +29 -0
  39. data/lib/shell_ev/models/coordinates.rb +70 -0
  40. data/lib/shell_ev/models/data_active.rb +153 -0
  41. data/lib/shell_ev/models/data_active_session_code_enum.rb +44 -0
  42. data/lib/shell_ev/models/data_active_session_state_enum.rb +35 -0
  43. data/lib/shell_ev/models/data_retrieve.rb +152 -0
  44. data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +44 -0
  45. data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +35 -0
  46. data/lib/shell_ev/models/electrical_properties.rb +81 -0
  47. data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +26 -0
  48. data/lib/shell_ev/models/env_enum.rb +23 -0
  49. data/lib/shell_ev/models/evse_vo.rb +143 -0
  50. data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +26 -0
  51. data/lib/shell_ev/models/evse_vo_status_enum.rb +29 -0
  52. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +78 -0
  53. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +23 -0
  54. data/lib/shell_ev/models/get_locations_list_authorization_methods_enum.rb +26 -0
  55. data/lib/shell_ev/models/get_locations_list_connector_types_enum.rb +71 -0
  56. data/lib/shell_ev/models/get_locations_list_evse_status_enum.rb +29 -0
  57. data/lib/shell_ev/models/get_markers_list_authorization_methods_enum.rb +26 -0
  58. data/lib/shell_ev/models/get_markers_list_connector_types_enum.rb +71 -0
  59. data/lib/shell_ev/models/get_markers_list_evse_status_enum.rb +29 -0
  60. data/lib/shell_ev/models/get_nearby_locations_authorization_methods_enum.rb +26 -0
  61. data/lib/shell_ev/models/get_nearby_locations_connector_types_enum.rb +71 -0
  62. data/lib/shell_ev/models/get_nearby_locations_evse_status_enum.rb +29 -0
  63. data/lib/shell_ev/models/inline_response202.rb +76 -0
  64. data/lib/shell_ev/models/inline_response2021.rb +58 -0
  65. data/lib/shell_ev/models/inline_response2021_status_enum.rb +23 -0
  66. data/lib/shell_ev/models/inline_response202_data.rb +48 -0
  67. data/lib/shell_ev/models/inline_response202_status_enum.rb +23 -0
  68. data/lib/shell_ev/models/location_respone_object.rb +172 -0
  69. data/lib/shell_ev/models/m400_error_response.rb +78 -0
  70. data/lib/shell_ev/models/m400_error_response_error.rb +80 -0
  71. data/lib/shell_ev/models/m401_error_response.rb +78 -0
  72. data/lib/shell_ev/models/m401_error_response_error.rb +80 -0
  73. data/lib/shell_ev/models/m404_error_response.rb +79 -0
  74. data/lib/shell_ev/models/m404_error_response_error.rb +80 -0
  75. data/lib/shell_ev/models/m405_error_response.rb +78 -0
  76. data/lib/shell_ev/models/m405_error_response_error.rb +80 -0
  77. data/lib/shell_ev/models/m429_error_response.rb +78 -0
  78. data/lib/shell_ev/models/m429_error_response_error.rb +80 -0
  79. data/lib/shell_ev/models/m500_error_response.rb +78 -0
  80. data/lib/shell_ev/models/m500_error_response_error.rb +80 -0
  81. data/lib/shell_ev/models/m503_error_response.rb +78 -0
  82. data/lib/shell_ev/models/m503_error_response_error.rb +80 -0
  83. data/lib/shell_ev/models/multi_location_marker.rb +126 -0
  84. data/lib/shell_ev/models/o_auth_provider_error_enum.rb +45 -0
  85. data/lib/shell_ev/models/o_auth_token.rb +100 -0
  86. data/lib/shell_ev/models/opening_hours_object.rb +70 -0
  87. data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +38 -0
  88. data/lib/shell_ev/models/response_base_status_enum.rb +26 -0
  89. data/lib/shell_ev/models/response_error401_all_of1.rb +57 -0
  90. data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +80 -0
  91. data/lib/shell_ev/models/single_location_marker.rb +157 -0
  92. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +26 -0
  93. data/lib/shell_ev/models/single_location_marker_status_enum.rb +30 -0
  94. data/lib/shell_ev/models/stop_charge_session_request_body_json.rb +48 -0
  95. data/lib/shell_ev/models/success_response.rb +58 -0
  96. data/lib/shell_ev/models/tariff_vo.rb +111 -0
  97. data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +29 -0
  98. data/lib/shell_ev/utilities/date_time_helper.rb +11 -0
  99. data/lib/shell_ev/utilities/file_wrapper.rb +16 -0
  100. data/lib/shell_ev/utilities/union_type_lookup.rb +38 -0
  101. data/lib/shell_ev.rb +125 -0
  102. data/test/controllers/controller_test_base.rb +34 -0
  103. data/test/controllers/test_charging_controller.rb +78 -0
  104. data/test/http_response_catcher.rb +19 -0
  105. metadata +224 -0
@@ -0,0 +1,126 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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 MultiLocationMarker < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Identifies the marker type. If it's a `MultiLocationMarker`, then the
14
+ # value is `MultiLocation`
15
+ # @return [String]
16
+ attr_accessor :marker_type
17
+
18
+ # Uniquely identifies the marker object
19
+ # @return [String]
20
+ attr_accessor :unique_key
21
+
22
+ # Coordinates of the Shell Recharge Site Location
23
+ # @return [Coordinates]
24
+ attr_accessor :coordinates
25
+
26
+ # Number of Locations that this Marker represents in the given set of bounds
27
+ # @return [Float]
28
+ attr_accessor :location_count
29
+
30
+ # Total number of Evses in Locations that this Marker represents
31
+ # @return [Float]
32
+ attr_accessor :evse_count
33
+
34
+ # Maximum power in kW across all locations grouped in this marker
35
+ # (disregarding availability)
36
+ # @return [Float]
37
+ attr_accessor :max_power
38
+
39
+ # GeoHash of marker coordinates
40
+ # @return [String]
41
+ attr_accessor :geo_hash
42
+
43
+ # A mapping from model property names to API property names.
44
+ def self.names
45
+ @_hash = {} if @_hash.nil?
46
+ @_hash['marker_type'] = 'markerType'
47
+ @_hash['unique_key'] = 'uniqueKey'
48
+ @_hash['coordinates'] = 'coordinates'
49
+ @_hash['location_count'] = 'locationCount'
50
+ @_hash['evse_count'] = 'evseCount'
51
+ @_hash['max_power'] = 'maxPower'
52
+ @_hash['geo_hash'] = 'geoHash'
53
+ @_hash
54
+ end
55
+
56
+ # An array for optional fields
57
+ def self.optionals
58
+ %w[
59
+ unique_key
60
+ coordinates
61
+ location_count
62
+ evse_count
63
+ max_power
64
+ geo_hash
65
+ ]
66
+ end
67
+
68
+ # An array for nullable fields
69
+ def self.nullables
70
+ []
71
+ end
72
+
73
+ def initialize(marker_type = nil,
74
+ unique_key = SKIP,
75
+ coordinates = SKIP,
76
+ location_count = SKIP,
77
+ evse_count = SKIP,
78
+ max_power = SKIP,
79
+ geo_hash = SKIP)
80
+ @marker_type = marker_type
81
+ @unique_key = unique_key unless unique_key == SKIP
82
+ @coordinates = coordinates unless coordinates == SKIP
83
+ @location_count = location_count unless location_count == SKIP
84
+ @evse_count = evse_count unless evse_count == SKIP
85
+ @max_power = max_power unless max_power == SKIP
86
+ @geo_hash = geo_hash unless geo_hash == SKIP
87
+ end
88
+
89
+ # Creates an instance of the object from a hash.
90
+ def self.from_hash(hash)
91
+ return nil unless hash
92
+
93
+ # Extract variables from the hash.
94
+ marker_type = hash.key?('markerType') ? hash['markerType'] : nil
95
+ unique_key = hash.key?('uniqueKey') ? hash['uniqueKey'] : SKIP
96
+ coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
97
+ location_count = hash.key?('locationCount') ? hash['locationCount'] : SKIP
98
+ evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
99
+ max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
100
+ geo_hash = hash.key?('geoHash') ? hash['geoHash'] : SKIP
101
+
102
+ # Create object from extracted values.
103
+ MultiLocationMarker.new(marker_type,
104
+ unique_key,
105
+ coordinates,
106
+ location_count,
107
+ evse_count,
108
+ max_power,
109
+ geo_hash)
110
+ end
111
+
112
+ # Validates an instance of the object from a given value.
113
+ # @param [MultiLocationMarker | Hash] The value against the validation is performed.
114
+ def self.validate(value)
115
+ if value.instance_of? self
116
+ return APIHelper.valid_type?(value.marker_type,
117
+ ->(val) { val.instance_of? String })
118
+ end
119
+
120
+ return false unless value.instance_of? Hash
121
+
122
+ APIHelper.valid_type?(value['markerType'],
123
+ ->(val) { val.instance_of? String })
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,45 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # OAuth 2 Authorization error codes
8
+ class OAuthProviderErrorEnum
9
+ O_AUTH_PROVIDER_ERROR_ENUM = [
10
+ # The request is missing a required parameter, includes an unsupported
11
+ # parameter value (other than grant type), repeats a parameter, includes
12
+ # multiple credentials, utilizes more than one mechanism for
13
+ # authenticating the client, or is otherwise malformed.
14
+ INVALID_REQUEST = 'invalid_request'.freeze,
15
+
16
+ # Client authentication failed (e.g., unknown client, no client
17
+ # authentication included, or unsupported authentication method).
18
+ INVALID_CLIENT = 'invalid_client'.freeze,
19
+
20
+ # The provided authorization grant (e.g., authorization code, resource
21
+ # owner credentials) or refresh token is invalid, expired, revoked, does
22
+ # not match the redirection URI used in the authorization request, or was
23
+ # issued to another client.
24
+ INVALID_GRANT = 'invalid_grant'.freeze,
25
+
26
+ # The authenticated client is not authorized to use this authorization
27
+ # grant type.
28
+ UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
29
+
30
+ # The authorization grant type is not supported by the authorization
31
+ # server.
32
+ UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
33
+
34
+ # The requested scope is invalid, unknown, malformed, or exceeds the scope
35
+ # granted by the resource owner.
36
+ INVALID_SCOPE = 'invalid_scope'.freeze
37
+ ].freeze
38
+
39
+ def self.validate(value)
40
+ return false if value.nil?
41
+
42
+ O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,100 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # OAuth 2 Authorization endpoint response
8
+ class OAuthToken < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Type of access token
17
+ # @return [String]
18
+ attr_accessor :token_type
19
+
20
+ # Time in seconds before the access token expires
21
+ # @return [Integer]
22
+ attr_accessor :expires_in
23
+
24
+ # List of scopes granted
25
+ # This is a space-delimited list of strings.
26
+ # @return [String]
27
+ attr_accessor :scope
28
+
29
+ # Time of token expiry as unix timestamp (UTC)
30
+ # @return [Integer]
31
+ attr_accessor :expiry
32
+
33
+ # Refresh token
34
+ # Used to get a new access token when it expires.
35
+ # @return [String]
36
+ attr_accessor :refresh_token
37
+
38
+ # A mapping from model property names to API property names.
39
+ def self.names
40
+ @_hash = {} if @_hash.nil?
41
+ @_hash['access_token'] = 'access_token'
42
+ @_hash['token_type'] = 'token_type'
43
+ @_hash['expires_in'] = 'expires_in'
44
+ @_hash['scope'] = 'scope'
45
+ @_hash['expiry'] = 'expiry'
46
+ @_hash['refresh_token'] = 'refresh_token'
47
+ @_hash
48
+ end
49
+
50
+ # An array for optional fields
51
+ def self.optionals
52
+ %w[
53
+ expires_in
54
+ scope
55
+ expiry
56
+ refresh_token
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(access_token = nil,
66
+ token_type = nil,
67
+ expires_in = SKIP,
68
+ scope = SKIP,
69
+ expiry = SKIP,
70
+ refresh_token = SKIP)
71
+ @access_token = access_token
72
+ @token_type = token_type
73
+ @expires_in = expires_in unless expires_in == SKIP
74
+ @scope = scope unless scope == SKIP
75
+ @expiry = expiry unless expiry == SKIP
76
+ @refresh_token = refresh_token unless refresh_token == SKIP
77
+ end
78
+
79
+ # Creates an instance of the object from a hash.
80
+ def self.from_hash(hash)
81
+ return nil unless hash
82
+
83
+ # Extract variables from the hash.
84
+ access_token = hash.key?('access_token') ? hash['access_token'] : nil
85
+ token_type = hash.key?('token_type') ? hash['token_type'] : nil
86
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
87
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
88
+ expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
89
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
90
+
91
+ # Create object from extracted values.
92
+ OAuthToken.new(access_token,
93
+ token_type,
94
+ expires_in,
95
+ scope,
96
+ expiry,
97
+ refresh_token)
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,70 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # OpeningHoursObject Model.
8
+ class OpeningHoursObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # 3 letter day of the week
13
+ # @return [OpeningHoursObjectWeekDayEnum]
14
+ attr_accessor :week_day
15
+
16
+ # Hour in 24h local time when the location opens.
17
+ # @return [String]
18
+ attr_accessor :start_time
19
+
20
+ # Hour in 24h local time when the location closes.
21
+ # @return [String]
22
+ attr_accessor :end_time
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['week_day'] = 'weekDay'
28
+ @_hash['start_time'] = 'startTime'
29
+ @_hash['end_time'] = 'endTime'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ week_day
37
+ start_time
38
+ end_time
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(week_day = SKIP,
48
+ start_time = SKIP,
49
+ end_time = SKIP)
50
+ @week_day = week_day unless week_day == SKIP
51
+ @start_time = start_time unless start_time == SKIP
52
+ @end_time = end_time unless end_time == SKIP
53
+ end
54
+
55
+ # Creates an instance of the object from a hash.
56
+ def self.from_hash(hash)
57
+ return nil unless hash
58
+
59
+ # Extract variables from the hash.
60
+ week_day = hash.key?('weekDay') ? hash['weekDay'] : SKIP
61
+ start_time = hash.key?('startTime') ? hash['startTime'] : SKIP
62
+ end_time = hash.key?('endTime') ? hash['endTime'] : SKIP
63
+
64
+ # Create object from extracted values.
65
+ OpeningHoursObject.new(week_day,
66
+ start_time,
67
+ end_time)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,38 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # 3 letter day of the week
8
+ class OpeningHoursObjectWeekDayEnum
9
+ OPENING_HOURS_OBJECT_WEEK_DAY_ENUM = [
10
+ # TODO: Write general description for SUN
11
+ SUN = 'Sun'.freeze,
12
+
13
+ # TODO: Write general description for MON
14
+ MON = 'Mon'.freeze,
15
+
16
+ # TODO: Write general description for TUE
17
+ TUE = 'Tue'.freeze,
18
+
19
+ # TODO: Write general description for WED
20
+ WED = 'Wed'.freeze,
21
+
22
+ # TODO: Write general description for THU
23
+ THU = 'Thu'.freeze,
24
+
25
+ # TODO: Write general description for FRI
26
+ FRI = 'Fri'.freeze,
27
+
28
+ # TODO: Write general description for SAT
29
+ SAT = 'Sat'.freeze
30
+ ].freeze
31
+
32
+ def self.validate(value)
33
+ return false if value.nil?
34
+
35
+ OPENING_HOURS_OBJECT_WEEK_DAY_ENUM.include?(value)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # Indicates overall status of the request
8
+ class ResponseBaseStatusEnum
9
+ RESPONSE_BASE_STATUS_ENUM = [
10
+ # TODO: Write general description for FAILED
11
+ FAILED = 'FAILED'.freeze,
12
+
13
+ # TODO: Write general description for PARTIAL_SUCCESS
14
+ PARTIAL_SUCCESS = 'PARTIAL_SUCCESS'.freeze,
15
+
16
+ # TODO: Write general description for SUCCESS
17
+ SUCCESS = 'SUCCESS'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ RESPONSE_BASE_STATUS_ENUM.include?(value)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,57 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # ResponseError401AllOf1 Model.
8
+ class ResponseError401AllOf1 < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Details of error(s) encountered
13
+ # @return [Array[ResponseError401AllOf1ErrorsItems]]
14
+ attr_accessor :errors
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['errors'] = 'Errors'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(errors = nil)
34
+ @errors = errors
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ # Parameter is an array, so we need to iterate through it
43
+ errors = nil
44
+ unless hash['Errors'].nil?
45
+ errors = []
46
+ hash['Errors'].each do |structure|
47
+ errors << (ResponseError401AllOf1ErrorsItems.from_hash(structure) if structure)
48
+ end
49
+ end
50
+
51
+ errors = nil unless hash.key?('Errors')
52
+
53
+ # Create object from extracted values.
54
+ ResponseError401AllOf1.new(errors)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,80 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # ResponseError401AllOf1ErrorsItems Model.
8
+ class ResponseError401AllOf1ErrorsItems < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Error code that logically best represents the error encountered
13
+ # @return [String]
14
+ attr_accessor :code
15
+
16
+ # Description of the error type
17
+ # @return [String]
18
+ attr_accessor :title
19
+
20
+ # Details of the error that can help under the cause of the error
21
+ # @return [String]
22
+ attr_accessor :detail
23
+
24
+ # Details of the error that can help under the cause of the error
25
+ # @return [Hash[String, String]]
26
+ attr_accessor :additional_info
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['code'] = 'Code'
32
+ @_hash['title'] = 'Title'
33
+ @_hash['detail'] = 'Detail'
34
+ @_hash['additional_info'] = 'AdditionalInfo'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ additional_info
42
+ ]
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ %w[
48
+ additional_info
49
+ ]
50
+ end
51
+
52
+ def initialize(code = nil,
53
+ title = nil,
54
+ detail = nil,
55
+ additional_info = SKIP)
56
+ @code = code
57
+ @title = title
58
+ @detail = detail
59
+ @additional_info = additional_info unless additional_info == SKIP
60
+ end
61
+
62
+ # Creates an instance of the object from a hash.
63
+ def self.from_hash(hash)
64
+ return nil unless hash
65
+
66
+ # Extract variables from the hash.
67
+ code = hash.key?('Code') ? hash['Code'] : nil
68
+ title = hash.key?('Title') ? hash['Title'] : nil
69
+ detail = hash.key?('Detail') ? hash['Detail'] : nil
70
+ additional_info =
71
+ hash.key?('AdditionalInfo') ? hash['AdditionalInfo'] : SKIP
72
+
73
+ # Create object from extracted values.
74
+ ResponseError401AllOf1ErrorsItems.new(code,
75
+ title,
76
+ detail,
77
+ additional_info)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,157 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # A Marker is a place on the map that represent a single Location
8
+ class SingleLocationMarker < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Identifies the marker type. If it''s a `SingleLocationMarker`, then the
13
+ # value is `SingleLocation`
14
+ # @return [String]
15
+ attr_accessor :marker_type
16
+
17
+ # Uniquely identifies the marker object
18
+ # @return [String]
19
+ attr_accessor :unique_key
20
+
21
+ # Minimum of all status values in the Marker, e.g. if at least one Evse in
22
+ # the Marker is available, the value will be available
23
+ # @return [SingleLocationMarkerStatusEnum]
24
+ attr_accessor :status
25
+
26
+ # Coordinates of the Shell Recharge Site Location
27
+ # @return [Coordinates]
28
+ attr_accessor :coordinates
29
+
30
+ # Total number of Evse units in Locations that this Marker represents
31
+ # @return [Float]
32
+ attr_accessor :evse_count
33
+
34
+ # Maximum power in kW across all locations grouped in this marker
35
+ # (disregarding availability)
36
+ # @return [Float]
37
+ attr_accessor :max_power
38
+
39
+ # GeoHash of marker coordinates
40
+ # @return [String]
41
+ attr_accessor :geo_hash
42
+
43
+ # Unique ID of the Location this Marker represents
44
+ # @return [Float]
45
+ attr_accessor :location_uid
46
+
47
+ # Methods that can be used to Authorize sessions on this EVSE
48
+ # @return [Array[SingleLocationMarkerAuthorizationMethodsItemsEnum]]
49
+ attr_accessor :authorization_methods
50
+
51
+ # Unique Id of the operator
52
+ # @return [String]
53
+ attr_accessor :operator_id
54
+
55
+ # A mapping from model property names to API property names.
56
+ def self.names
57
+ @_hash = {} if @_hash.nil?
58
+ @_hash['marker_type'] = 'markerType'
59
+ @_hash['unique_key'] = 'uniqueKey'
60
+ @_hash['status'] = 'status'
61
+ @_hash['coordinates'] = 'coordinates'
62
+ @_hash['evse_count'] = 'evseCount'
63
+ @_hash['max_power'] = 'maxPower'
64
+ @_hash['geo_hash'] = 'geoHash'
65
+ @_hash['location_uid'] = 'locationUid'
66
+ @_hash['authorization_methods'] = 'authorizationMethods'
67
+ @_hash['operator_id'] = 'operatorId'
68
+ @_hash
69
+ end
70
+
71
+ # An array for optional fields
72
+ def self.optionals
73
+ %w[
74
+ unique_key
75
+ status
76
+ coordinates
77
+ evse_count
78
+ max_power
79
+ geo_hash
80
+ location_uid
81
+ authorization_methods
82
+ operator_id
83
+ ]
84
+ end
85
+
86
+ # An array for nullable fields
87
+ def self.nullables
88
+ []
89
+ end
90
+
91
+ def initialize(marker_type = nil,
92
+ unique_key = SKIP,
93
+ status = SKIP,
94
+ coordinates = SKIP,
95
+ evse_count = SKIP,
96
+ max_power = SKIP,
97
+ geo_hash = SKIP,
98
+ location_uid = SKIP,
99
+ authorization_methods = SKIP,
100
+ operator_id = SKIP)
101
+ @marker_type = marker_type
102
+ @unique_key = unique_key unless unique_key == SKIP
103
+ @status = status unless status == SKIP
104
+ @coordinates = coordinates unless coordinates == SKIP
105
+ @evse_count = evse_count unless evse_count == SKIP
106
+ @max_power = max_power unless max_power == SKIP
107
+ @geo_hash = geo_hash unless geo_hash == SKIP
108
+ @location_uid = location_uid unless location_uid == SKIP
109
+ @authorization_methods = authorization_methods unless authorization_methods == SKIP
110
+ @operator_id = operator_id unless operator_id == SKIP
111
+ end
112
+
113
+ # Creates an instance of the object from a hash.
114
+ def self.from_hash(hash)
115
+ return nil unless hash
116
+
117
+ # Extract variables from the hash.
118
+ marker_type = hash.key?('markerType') ? hash['markerType'] : nil
119
+ unique_key = hash.key?('uniqueKey') ? hash['uniqueKey'] : SKIP
120
+ status = hash.key?('status') ? hash['status'] : SKIP
121
+ coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
122
+ evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
123
+ max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
124
+ geo_hash = hash.key?('geoHash') ? hash['geoHash'] : SKIP
125
+ location_uid = hash.key?('locationUid') ? hash['locationUid'] : SKIP
126
+ authorization_methods =
127
+ hash.key?('authorizationMethods') ? hash['authorizationMethods'] : SKIP
128
+ operator_id = hash.key?('operatorId') ? hash['operatorId'] : SKIP
129
+
130
+ # Create object from extracted values.
131
+ SingleLocationMarker.new(marker_type,
132
+ unique_key,
133
+ status,
134
+ coordinates,
135
+ evse_count,
136
+ max_power,
137
+ geo_hash,
138
+ location_uid,
139
+ authorization_methods,
140
+ operator_id)
141
+ end
142
+
143
+ # Validates an instance of the object from a given value.
144
+ # @param [SingleLocationMarker | Hash] The value against the validation is performed.
145
+ def self.validate(value)
146
+ if value.instance_of? self
147
+ return APIHelper.valid_type?(value.marker_type,
148
+ ->(val) { val.instance_of? String })
149
+ end
150
+
151
+ return false unless value.instance_of? Hash
152
+
153
+ APIHelper.valid_type?(value['markerType'],
154
+ ->(val) { val.instance_of? String })
155
+ end
156
+ end
157
+ end