ev-recharge-sdk 1.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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +92 -0
- data/lib/shell_ev/api_helper.rb +10 -0
- data/lib/shell_ev/client.rb +77 -0
- data/lib/shell_ev/configuration.rb +110 -0
- data/lib/shell_ev/controllers/base_controller.rb +66 -0
- data/lib/shell_ev/controllers/charging_controller.rb +216 -0
- data/lib/shell_ev/controllers/locations_controller.rb +352 -0
- data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +42 -0
- data/lib/shell_ev/exceptions/api_exception.rb +10 -0
- data/lib/shell_ev/exceptions/bad_request_exception.rb +37 -0
- data/lib/shell_ev/exceptions/http401_error_response_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m400_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m401_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +53 -0
- data/lib/shell_ev/exceptions/m405_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +52 -0
- data/lib/shell_ev/exceptions/not_found_exception.rb +37 -0
- data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/shell_ev/exceptions/unauthorized_exception.rb +37 -0
- data/lib/shell_ev/http/auth/o_auth2.rb +90 -0
- data/lib/shell_ev/http/http_call_back.rb +10 -0
- data/lib/shell_ev/http/http_method_enum.rb +10 -0
- data/lib/shell_ev/http/http_request.rb +10 -0
- data/lib/shell_ev/http/http_response.rb +10 -0
- data/lib/shell_ev/models/accessibility.rb +60 -0
- data/lib/shell_ev/models/accessibility_status_enum.rb +29 -0
- data/lib/shell_ev/models/active_response200_json.rb +78 -0
- data/lib/shell_ev/models/active_response200_json_status_enum.rb +23 -0
- data/lib/shell_ev/models/address.rb +81 -0
- data/lib/shell_ev/models/base_model.rb +62 -0
- data/lib/shell_ev/models/chargesession_start_body.rb +59 -0
- data/lib/shell_ev/models/connector_vo.rb +134 -0
- data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +71 -0
- data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +29 -0
- data/lib/shell_ev/models/coordinates.rb +70 -0
- data/lib/shell_ev/models/data_active.rb +153 -0
- data/lib/shell_ev/models/data_active_session_code_enum.rb +44 -0
- data/lib/shell_ev/models/data_active_session_state_enum.rb +35 -0
- data/lib/shell_ev/models/data_retrieve.rb +152 -0
- data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +44 -0
- data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +35 -0
- data/lib/shell_ev/models/electrical_properties.rb +81 -0
- data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +26 -0
- data/lib/shell_ev/models/env_enum.rb +23 -0
- data/lib/shell_ev/models/evse_vo.rb +143 -0
- data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +26 -0
- data/lib/shell_ev/models/evse_vo_status_enum.rb +29 -0
- data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +78 -0
- data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +23 -0
- data/lib/shell_ev/models/get_locations_list_authorization_methods_enum.rb +26 -0
- data/lib/shell_ev/models/get_locations_list_connector_types_enum.rb +71 -0
- data/lib/shell_ev/models/get_locations_list_evse_status_enum.rb +29 -0
- data/lib/shell_ev/models/get_markers_list_authorization_methods_enum.rb +26 -0
- data/lib/shell_ev/models/get_markers_list_connector_types_enum.rb +71 -0
- data/lib/shell_ev/models/get_markers_list_evse_status_enum.rb +29 -0
- data/lib/shell_ev/models/get_nearby_locations_authorization_methods_enum.rb +26 -0
- data/lib/shell_ev/models/get_nearby_locations_connector_types_enum.rb +71 -0
- data/lib/shell_ev/models/get_nearby_locations_evse_status_enum.rb +29 -0
- data/lib/shell_ev/models/inline_response202.rb +76 -0
- data/lib/shell_ev/models/inline_response2021.rb +58 -0
- data/lib/shell_ev/models/inline_response2021_status_enum.rb +23 -0
- data/lib/shell_ev/models/inline_response202_data.rb +48 -0
- data/lib/shell_ev/models/inline_response202_status_enum.rb +23 -0
- data/lib/shell_ev/models/location_respone_object.rb +172 -0
- data/lib/shell_ev/models/m400_error_response.rb +78 -0
- data/lib/shell_ev/models/m400_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m401_error_response.rb +78 -0
- data/lib/shell_ev/models/m401_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m404_error_response.rb +79 -0
- data/lib/shell_ev/models/m404_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m405_error_response.rb +78 -0
- data/lib/shell_ev/models/m405_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m429_error_response.rb +78 -0
- data/lib/shell_ev/models/m429_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m500_error_response.rb +78 -0
- data/lib/shell_ev/models/m500_error_response_error.rb +80 -0
- data/lib/shell_ev/models/m503_error_response.rb +78 -0
- data/lib/shell_ev/models/m503_error_response_error.rb +80 -0
- data/lib/shell_ev/models/multi_location_marker.rb +126 -0
- data/lib/shell_ev/models/o_auth_provider_error_enum.rb +45 -0
- data/lib/shell_ev/models/o_auth_token.rb +100 -0
- data/lib/shell_ev/models/opening_hours_object.rb +70 -0
- data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +38 -0
- data/lib/shell_ev/models/response_base_status_enum.rb +26 -0
- data/lib/shell_ev/models/response_error401_all_of1.rb +57 -0
- data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +80 -0
- data/lib/shell_ev/models/single_location_marker.rb +157 -0
- data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +26 -0
- data/lib/shell_ev/models/single_location_marker_status_enum.rb +30 -0
- data/lib/shell_ev/models/stop_charge_session_request_body_json.rb +48 -0
- data/lib/shell_ev/models/success_response.rb +58 -0
- data/lib/shell_ev/models/tariff_vo.rb +111 -0
- data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +29 -0
- data/lib/shell_ev/utilities/date_time_helper.rb +11 -0
- data/lib/shell_ev/utilities/file_wrapper.rb +16 -0
- data/lib/shell_ev/utilities/union_type_lookup.rb +38 -0
- data/lib/shell_ev.rb +125 -0
- data/test/controllers/controller_test_base.rb +34 -0
- data/test/controllers/test_charging_controller.rb +78 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +224 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Method Not Allowed
|
8
|
+
class M405ErrorResponseError1Exception < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Mandatory UUID (according to RFC 4122 standards) for requests and
|
13
|
+
# responses. This will be played back in the response from the request.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
17
|
+
# Indicates overall status of the request
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# Indicates overall status of the request
|
22
|
+
# @return [Array[M405ErrorResponseError]]
|
23
|
+
attr_accessor :errors
|
24
|
+
|
25
|
+
# The constructor.
|
26
|
+
# @param [String] The reason for raising an exception.
|
27
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
28
|
+
def initialize(reason, response)
|
29
|
+
super(reason, response)
|
30
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
31
|
+
unbox(hash)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Populates this object by extracting properties from a hash.
|
35
|
+
# @param [Hash] The deserialized response sent by the server in the
|
36
|
+
# response body.
|
37
|
+
def unbox(hash)
|
38
|
+
@request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
|
39
|
+
@status = hash.key?('Status') ? hash['Status'] : nil
|
40
|
+
# Parameter is an array, so we need to iterate through it
|
41
|
+
@errors = nil
|
42
|
+
unless hash['Errors'].nil?
|
43
|
+
@errors = []
|
44
|
+
hash['Errors'].each do |structure|
|
45
|
+
@errors << (M405ErrorResponseError.from_hash(structure) if structure)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
@errors = SKIP unless hash.key?('Errors')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Too Many Requests
|
8
|
+
class M429ErrorResponseError1Exception < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Mandatory UUID (according to RFC 4122 standards) for requests and
|
13
|
+
# responses. This will be played back in the response from the request.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
17
|
+
# Indicates overall status of the request
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# Indicates overall status of the request
|
22
|
+
# @return [Array[M429ErrorResponseError]]
|
23
|
+
attr_accessor :errors
|
24
|
+
|
25
|
+
# The constructor.
|
26
|
+
# @param [String] The reason for raising an exception.
|
27
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
28
|
+
def initialize(reason, response)
|
29
|
+
super(reason, response)
|
30
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
31
|
+
unbox(hash)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Populates this object by extracting properties from a hash.
|
35
|
+
# @param [Hash] The deserialized response sent by the server in the
|
36
|
+
# response body.
|
37
|
+
def unbox(hash)
|
38
|
+
@request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
|
39
|
+
@status = hash.key?('Status') ? hash['Status'] : nil
|
40
|
+
# Parameter is an array, so we need to iterate through it
|
41
|
+
@errors = nil
|
42
|
+
unless hash['Errors'].nil?
|
43
|
+
@errors = []
|
44
|
+
hash['Errors'].each do |structure|
|
45
|
+
@errors << (M429ErrorResponseError.from_hash(structure) if structure)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
@errors = SKIP unless hash.key?('Errors')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# 500ErrorResponse_Error1 class.
|
8
|
+
class M500ErrorResponseError1Exception < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Mandatory UUID (according to RFC 4122 standards) for requests and
|
13
|
+
# responses. This will be played back in the response from the request.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
17
|
+
# Indicates overall status of the request
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# Indicates overall status of the request
|
22
|
+
# @return [Array[M500ErrorResponseError]]
|
23
|
+
attr_accessor :errors
|
24
|
+
|
25
|
+
# The constructor.
|
26
|
+
# @param [String] The reason for raising an exception.
|
27
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
28
|
+
def initialize(reason, response)
|
29
|
+
super(reason, response)
|
30
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
31
|
+
unbox(hash)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Populates this object by extracting properties from a hash.
|
35
|
+
# @param [Hash] The deserialized response sent by the server in the
|
36
|
+
# response body.
|
37
|
+
def unbox(hash)
|
38
|
+
@request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
|
39
|
+
@status = hash.key?('Status') ? hash['Status'] : nil
|
40
|
+
# Parameter is an array, so we need to iterate through it
|
41
|
+
@errors = nil
|
42
|
+
unless hash['Errors'].nil?
|
43
|
+
@errors = []
|
44
|
+
hash['Errors'].each do |structure|
|
45
|
+
@errors << (M500ErrorResponseError.from_hash(structure) if structure)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
@errors = SKIP unless hash.key?('Errors')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# 503ErrorResponse_Error1 class.
|
8
|
+
class M503ErrorResponseError1Exception < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Mandatory UUID (according to RFC 4122 standards) for requests and
|
13
|
+
# responses. This will be played back in the response from the request.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
17
|
+
# Indicates overall status of the request
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# Indicates overall status of the request
|
22
|
+
# @return [Array[M503ErrorResponseError]]
|
23
|
+
attr_accessor :errors
|
24
|
+
|
25
|
+
# The constructor.
|
26
|
+
# @param [String] The reason for raising an exception.
|
27
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
28
|
+
def initialize(reason, response)
|
29
|
+
super(reason, response)
|
30
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
31
|
+
unbox(hash)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Populates this object by extracting properties from a hash.
|
35
|
+
# @param [Hash] The deserialized response sent by the server in the
|
36
|
+
# response body.
|
37
|
+
def unbox(hash)
|
38
|
+
@request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
|
39
|
+
@status = hash.key?('Status') ? hash['Status'] : nil
|
40
|
+
# Parameter is an array, so we need to iterate through it
|
41
|
+
@errors = nil
|
42
|
+
unless hash['Errors'].nil?
|
43
|
+
@errors = []
|
44
|
+
hash['Errors'].each do |structure|
|
45
|
+
@errors << (M503ErrorResponseError.from_hash(structure) if structure)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
@errors = SKIP unless hash.key?('Errors')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# NotFound class.
|
8
|
+
class NotFoundException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Error code
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :code
|
15
|
+
|
16
|
+
# Error desctiption in English
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :message
|
19
|
+
|
20
|
+
# The constructor.
|
21
|
+
# @param [String] The reason for raising an exception.
|
22
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
23
|
+
def initialize(reason, response)
|
24
|
+
super(reason, response)
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
26
|
+
unbox(hash)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Populates this object by extracting properties from a hash.
|
30
|
+
# @param [Hash] The deserialized response sent by the server in the
|
31
|
+
# response body.
|
32
|
+
def unbox(hash)
|
33
|
+
@code = hash.key?('code') ? hash['code'] : SKIP
|
34
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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 exception.
|
8
|
+
class OAuthProviderException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Gets or sets error code.
|
13
|
+
# @return [OAuthProviderErrorEnum]
|
14
|
+
attr_accessor :error
|
15
|
+
|
16
|
+
# Gets or sets human-readable text providing additional information on
|
17
|
+
# error.
|
18
|
+
# Used to assist the client developer in understanding the error that
|
19
|
+
# occurred.
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :error_description
|
22
|
+
|
23
|
+
# Gets or sets a URI identifying a human-readable web page with information
|
24
|
+
# about the error, used to provide the client developer with additional
|
25
|
+
# information about the error.
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :error_uri
|
28
|
+
|
29
|
+
# The constructor.
|
30
|
+
# @param [String] The reason for raising an exception.
|
31
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
32
|
+
def initialize(reason, response)
|
33
|
+
super(reason, response)
|
34
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
35
|
+
unbox(hash)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Populates this object by extracting properties from a hash.
|
39
|
+
# @param [Hash] The deserialized response sent by the server in the
|
40
|
+
# response body.
|
41
|
+
def unbox(hash)
|
42
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
43
|
+
@error_description =
|
44
|
+
hash.key?('error_description') ? hash['error_description'] : SKIP
|
45
|
+
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Unauthorized class.
|
8
|
+
class UnauthorizedException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Error code
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :code
|
15
|
+
|
16
|
+
# Error desctiption in English
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :message
|
19
|
+
|
20
|
+
# The constructor.
|
21
|
+
# @param [String] The reason for raising an exception.
|
22
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
23
|
+
def initialize(reason, response)
|
24
|
+
super(reason, response)
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
26
|
+
unbox(hash)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Populates this object by extracting properties from a hash.
|
30
|
+
# @param [Hash] The deserialized response sent by the server in the
|
31
|
+
# response body.
|
32
|
+
def unbox(hash)
|
33
|
+
@code = hash.key?('code') ? hash['code'] : SKIP
|
34
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Utility class for OAuth 2 authorization and token management.
|
8
|
+
class OAuth2 < CoreLibrary::HeaderAuth
|
9
|
+
include CoreLibrary
|
10
|
+
# Display error message on occurrence of authentication failure.
|
11
|
+
# @returns [String] The oAuth error message.
|
12
|
+
def error_message
|
13
|
+
'ClientCredentialsAuth: OAuthToken is undefined or expired.'
|
14
|
+
end
|
15
|
+
|
16
|
+
# Initialization constructor.
|
17
|
+
def initialize(client_credentials_auth_credentials, config)
|
18
|
+
auth_params = {}
|
19
|
+
@_o_auth_client_id = client_credentials_auth_credentials.o_auth_client_id unless
|
20
|
+
client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.o_auth_client_id.nil?
|
21
|
+
@_o_auth_client_secret = client_credentials_auth_credentials.o_auth_client_secret unless
|
22
|
+
client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.o_auth_client_secret.nil?
|
23
|
+
@_o_auth_token = client_credentials_auth_credentials.o_auth_token unless
|
24
|
+
client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.o_auth_token.nil?
|
25
|
+
@_o_auth_api = OAuthAuthorizationController.new(config)
|
26
|
+
auth_params['Authorization'] = "Bearer #{@_o_auth_token.access_token}" unless @_o_auth_token.nil?
|
27
|
+
|
28
|
+
super auth_params
|
29
|
+
end
|
30
|
+
|
31
|
+
# Validates the oAuth token.
|
32
|
+
# @return [Boolean] true if the token is present and not expired.
|
33
|
+
def valid
|
34
|
+
!@_o_auth_token.nil? && !token_expired?(@_o_auth_token)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Builds the basic auth header for endpoints in the OAuth Authorization Controller.
|
38
|
+
# @return [String] The value of the Authentication header.
|
39
|
+
def build_basic_auth_header
|
40
|
+
"Basic #{AuthHelper.get_base64_encoded_value(@_o_auth_client_id, @_o_auth_client_secret)}"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Fetches the token.
|
44
|
+
# @param [Hash] additional_params Any additional form parameters.
|
45
|
+
# @return [OAuthToken] The oAuth token instance.
|
46
|
+
def fetch_token(additional_params: nil)
|
47
|
+
token = @_o_auth_api.request_token(
|
48
|
+
build_basic_auth_header,
|
49
|
+
_field_parameters: additional_params
|
50
|
+
)
|
51
|
+
if token.respond_to?('expires_in') && !token.expires_in.nil?
|
52
|
+
token.expiry = AuthHelper.get_token_expiry(token.expires_in, Time.now.utc.to_i)
|
53
|
+
end
|
54
|
+
token
|
55
|
+
end
|
56
|
+
|
57
|
+
# Checks if OAuth token has expired.
|
58
|
+
# @param [OAuthToken] token The oAuth token instance.
|
59
|
+
# @return [Boolean] true if the token's expiry exist and also the token is expired, false otherwise.
|
60
|
+
def token_expired?(token)
|
61
|
+
token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Data class for ClientCredentialsAuthCredentials.
|
66
|
+
class ClientCredentialsAuthCredentials
|
67
|
+
attr_reader :o_auth_client_id, :o_auth_client_secret, :o_auth_token
|
68
|
+
|
69
|
+
def initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil)
|
70
|
+
raise ArgumentError, 'o_auth_client_id cannot be nil' if o_auth_client_id.nil?
|
71
|
+
raise ArgumentError, 'o_auth_client_secret cannot be nil' if o_auth_client_secret.nil?
|
72
|
+
|
73
|
+
@o_auth_client_id = o_auth_client_id
|
74
|
+
@o_auth_client_secret = o_auth_client_secret
|
75
|
+
@o_auth_token = o_auth_token
|
76
|
+
end
|
77
|
+
|
78
|
+
def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
|
79
|
+
o_auth_token: nil)
|
80
|
+
o_auth_client_id ||= self.o_auth_client_id
|
81
|
+
o_auth_client_secret ||= self.o_auth_client_secret
|
82
|
+
o_auth_token ||= self.o_auth_token
|
83
|
+
|
84
|
+
ClientCredentialsAuthCredentials.new(
|
85
|
+
o_auth_client_id: o_auth_client_id,
|
86
|
+
o_auth_client_secret: o_auth_client_secret, o_auth_token: o_auth_token
|
87
|
+
)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Accessibility of the Location
|
8
|
+
class Accessibility < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Accessibility Status
|
13
|
+
# @return [AccessibilityStatusEnum]
|
14
|
+
attr_accessor :status
|
15
|
+
|
16
|
+
# optional Arbitrary text about restrictions of the Location
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :remark
|
19
|
+
|
20
|
+
# A mapping from model property names to API property names.
|
21
|
+
def self.names
|
22
|
+
@_hash = {} if @_hash.nil?
|
23
|
+
@_hash['status'] = 'status'
|
24
|
+
@_hash['remark'] = 'remark'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
# An array for optional fields
|
29
|
+
def self.optionals
|
30
|
+
%w[
|
31
|
+
status
|
32
|
+
remark
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
# An array for nullable fields
|
37
|
+
def self.nullables
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize(status = SKIP,
|
42
|
+
remark = SKIP)
|
43
|
+
@status = status unless status == SKIP
|
44
|
+
@remark = remark unless remark == SKIP
|
45
|
+
end
|
46
|
+
|
47
|
+
# Creates an instance of the object from a hash.
|
48
|
+
def self.from_hash(hash)
|
49
|
+
return nil unless hash
|
50
|
+
|
51
|
+
# Extract variables from the hash.
|
52
|
+
status = hash.key?('status') ? hash['status'] : SKIP
|
53
|
+
remark = hash.key?('remark') ? hash['remark'] : SKIP
|
54
|
+
|
55
|
+
# Create object from extracted values.
|
56
|
+
Accessibility.new(status,
|
57
|
+
remark)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# Accessibility Status
|
8
|
+
class AccessibilityStatusEnum
|
9
|
+
ACCESSIBILITY_STATUS_ENUM = [
|
10
|
+
# TODO: Write general description for FREEPUBLIC
|
11
|
+
FREEPUBLIC = 'FreePublic'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for PAYINGPUBLIC
|
14
|
+
PAYINGPUBLIC = 'PayingPublic'.freeze,
|
15
|
+
|
16
|
+
# TODO: Write general description for RESTRICTED
|
17
|
+
RESTRICTED = 'Restricted'.freeze,
|
18
|
+
|
19
|
+
# TODO: Write general description for UNSPECIFIED
|
20
|
+
UNSPECIFIED = 'Unspecified'.freeze
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
def self.validate(value)
|
24
|
+
return false if value.nil?
|
25
|
+
|
26
|
+
ACCESSIBILITY_STATUS_ENUM.include?(value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# shell_ev
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module ShellEv
|
7
|
+
# ActiveResponse200Json Model.
|
8
|
+
class ActiveResponse200Json < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# A unique request id in GUID format. The value is written to the Shell API
|
13
|
+
# Platform audit log for end to end traceability of a request.
|
14
|
+
# @return [UUID | String]
|
15
|
+
attr_accessor :request_id
|
16
|
+
|
17
|
+
# Indicates overall status of the request
|
18
|
+
# @return [ActiveResponse200JsonStatusEnum]
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# Indicates overall status of the request
|
22
|
+
# @return [Array[DataActive]]
|
23
|
+
attr_accessor :data
|
24
|
+
|
25
|
+
# A mapping from model property names to API property names.
|
26
|
+
def self.names
|
27
|
+
@_hash = {} if @_hash.nil?
|
28
|
+
@_hash['request_id'] = 'RequestId'
|
29
|
+
@_hash['status'] = 'Status'
|
30
|
+
@_hash['data'] = 'Data'
|
31
|
+
@_hash
|
32
|
+
end
|
33
|
+
|
34
|
+
# An array for optional fields
|
35
|
+
def self.optionals
|
36
|
+
%w[
|
37
|
+
data
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# An array for nullable fields
|
42
|
+
def self.nullables
|
43
|
+
[]
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize(request_id = nil,
|
47
|
+
status = nil,
|
48
|
+
data = SKIP)
|
49
|
+
@request_id = request_id
|
50
|
+
@status = status
|
51
|
+
@data = data unless data == SKIP
|
52
|
+
end
|
53
|
+
|
54
|
+
# Creates an instance of the object from a hash.
|
55
|
+
def self.from_hash(hash)
|
56
|
+
return nil unless hash
|
57
|
+
|
58
|
+
# Extract variables from the hash.
|
59
|
+
request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
|
60
|
+
status = hash.key?('Status') ? hash['Status'] : nil
|
61
|
+
# Parameter is an array, so we need to iterate through it
|
62
|
+
data = nil
|
63
|
+
unless hash['Data'].nil?
|
64
|
+
data = []
|
65
|
+
hash['Data'].each do |structure|
|
66
|
+
data << (DataActive.from_hash(structure) if structure)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
data = SKIP unless hash.key?('Data')
|
71
|
+
|
72
|
+
# Create object from extracted values.
|
73
|
+
ActiveResponse200Json.new(request_id,
|
74
|
+
status,
|
75
|
+
data)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,23 @@
|
|
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 ActiveResponse200JsonStatusEnum
|
9
|
+
ACTIVE_RESPONSE200_JSON_STATUS_ENUM = [
|
10
|
+
# TODO: Write general description for SUCCESS
|
11
|
+
SUCCESS = 'SUCCESS'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for FAILED
|
14
|
+
FAILED = 'FAILED'.freeze
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
def self.validate(value)
|
18
|
+
return false if value.nil?
|
19
|
+
|
20
|
+
ACTIVE_RESPONSE200_JSON_STATUS_ENUM.include?(value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|