ev-recharge-sdk 1.4.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 +2 -2
  13. data/lib/shell_ev/exceptions/bad_request_exception.rb +7 -5
  14. data/lib/shell_ev/exceptions/internal_server_error_exception.rb +7 -5
  15. data/lib/shell_ev/exceptions/not_found_exception.rb +7 -5
  16. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +7 -5
  17. data/lib/shell_ev/exceptions/serviceunavailable_exception.rb +7 -5
  18. data/lib/shell_ev/exceptions/too_many_requests_exception.rb +7 -5
  19. data/lib/shell_ev/exceptions/unauthorized_exception.rb +7 -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} +7 -16
  31. data/lib/shell_ev/models/active_response200_json.rb +2 -2
  32. data/lib/shell_ev/models/active_response200_json_status_enum.rb +15 -2
  33. data/lib/shell_ev/models/address.rb +2 -2
  34. data/lib/shell_ev/models/bad_request_err_msg.rb +2 -2
  35. data/lib/shell_ev/models/base_model.rb +2 -2
  36. data/lib/shell_ev/models/charge_error.rb +2 -2
  37. data/lib/shell_ev/models/charge_retrieve_state.rb +2 -2
  38. data/lib/shell_ev/models/chargesession_start_body.rb +2 -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 +2 -2
  44. data/lib/shell_ev/models/coordinates1.rb +81 -0
  45. data/lib/shell_ev/models/data_active.rb +2 -2
  46. data/lib/shell_ev/models/data_retrieve.rb +2 -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} +8 -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} +33 -43
  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 +2 -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 +4 -6
  60. data/lib/shell_ev/models/inline_response2021.rb +2 -2
  61. data/lib/shell_ev/models/inline_response2021_status_enum.rb +15 -2
  62. data/lib/shell_ev/models/inline_response202_data.rb +2 -2
  63. data/lib/shell_ev/models/inline_response202_status_enum.rb +15 -2
  64. data/lib/shell_ev/models/internal_error_object.rb +2 -2
  65. data/lib/shell_ev/models/{location_respone_object.rb → location_respone_object_v2.rb} +46 -34
  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 +5 -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 +2 -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 +3 -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 +2 -2
  82. data/lib/shell_ev/models/{response.rb → response_v2.rb} +9 -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 +2 -2
  89. data/lib/shell_ev/models/single_location_marker.rb +8 -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 +2 -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 +3 -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 +2 -2
  103. data/lib/shell_ev/utilities/date_time_helper.rb +2 -2
  104. data/lib/shell_ev/utilities/file_wrapper.rb +2 -2
  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 -149
  113. data/lib/shell_ev/models/tariff_vo.rb +0 -124
@@ -0,0 +1,67 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ShellEv
7
+ # V2 Charge Session Stop 404 Error class.
8
+ class V2ChargeSessionStop404ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # requestId is unique identifier value that is attached to requests and
13
+ # messages that allow reference to a particular transaction or event chain.
14
+ # @return [String]
15
+ attr_accessor :request_id
16
+
17
+ # Status of the request
18
+ # @return [String]
19
+ attr_accessor :status
20
+
21
+ # Exception details of the error
22
+ # @return [Array[NotFoundErrMsg]]
23
+ attr_accessor :errors
24
+
25
+ # The constructor.
26
+ # @param [String] reason The reason for raising an exception.
27
+ # @param [HttpResponse] response 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] hash The deserialized response sent by the server in the
36
+ # response body.
37
+ def unbox(hash)
38
+ return nil unless hash
39
+
40
+ @request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
41
+ @status = hash.key?('status') ? hash['status'] : SKIP
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 << (NotFoundErrMsg.from_hash(structure) if structure)
48
+ end
49
+ end
50
+
51
+ @errors = SKIP unless hash.key?('errors')
52
+ end
53
+
54
+ # Provides a human-readable string representation of the object.
55
+ def to_s
56
+ class_name = self.class.name.split('::').last
57
+ "<#{class_name} request_id: #{@request_id}, status: #{@status}, errors: #{@errors}>"
58
+ end
59
+
60
+ # Provides a debugging-friendly string with detailed object information.
61
+ def inspect
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} request_id: #{@request_id.inspect}, status: #{@status.inspect}, errors:"\
64
+ " #{@errors.inspect}>"
65
+ end
66
+ end
67
+ 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
  # Utility class for OAuth 2 authorization and token management.
@@ -100,7 +100,7 @@ module ShellEv
100
100
 
101
101
  def initialize(o_auth_client_id:, o_auth_client_secret:, o_auth_token: nil,
102
102
  o_auth_token_provider: nil, o_auth_on_token_update: nil,
103
- o_auth_clock_skew: nil)
103
+ o_auth_clock_skew: 0)
104
104
  raise ArgumentError, 'o_auth_client_id cannot be nil' if o_auth_client_id.nil?
105
105
  raise ArgumentError, 'o_auth_client_secret cannot be nil' if o_auth_client_secret.nil?
106
106
 
@@ -112,6 +112,21 @@ module ShellEv
112
112
  @o_auth_clock_skew = o_auth_clock_skew
113
113
  end
114
114
 
115
+ def self.from_env
116
+ o_auth_client_id = ENV['O_AUTH_CLIENT_ID']
117
+ o_auth_client_secret = ENV['O_AUTH_CLIENT_SECRET']
118
+ o_auth_clock_skew = ENV['O_AUTH_CLOCK_SKEW']
119
+ all_nil = [
120
+ o_auth_client_id,
121
+ o_auth_client_secret
122
+ ].all?(&:nil?)
123
+ return nil if all_nil
124
+
125
+ new(o_auth_client_id: o_auth_client_id,
126
+ o_auth_client_secret: o_auth_client_secret,
127
+ o_auth_clock_skew: o_auth_clock_skew)
128
+ end
129
+
115
130
  def clone_with(o_auth_client_id: nil, o_auth_client_secret: nil,
116
131
  o_auth_token: nil, o_auth_token_provider: nil,
117
132
  o_auth_on_token_update: nil, o_auth_clock_skew: nil)
@@ -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
  # HttpCallBack allows defining callables for pre and post API calls.
@@ -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
  # HTTP Methods Enumeration.
@@ -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
  # Represents a single Http Request.
@@ -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
  # Http response received.
@@ -0,0 +1,22 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ShellEv
7
+ ##
8
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
9
+ # including optional basic authentication.
10
+ #
11
+ class ProxySettings < CoreLibrary::ProxySettings
12
+ def self.from_env
13
+ address = ENV['PROXY_ADDRESS']
14
+ port = ENV['PROXY_PORT']
15
+ username = ENV['PROXY_USERNAME']
16
+ password = ENV['PROXY_PASSWORD']
17
+ return nil if address.nil? || address.strip.empty?
18
+
19
+ new(address: address, port: port, username: username, password: password)
20
+ end
21
+ end
22
+ 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
  # Accessibility Status
@@ -25,5 +25,20 @@ module ShellEv
25
25
 
26
26
  ACCESSIBILITY_STATUS_ENUM.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = FREEPUBLIC)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'freepublic' then FREEPUBLIC
36
+ when 'payingpublic' then PAYINGPUBLIC
37
+ when 'restricted' then RESTRICTED
38
+ when 'unspecified' then UNSPECIFIED
39
+ else
40
+ default_value
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -1,11 +1,11 @@
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
  # Accessibility of the Location
8
- class Accessibility < BaseModel
8
+ class AccessibilityV2 < BaseModel
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
@@ -13,15 +13,10 @@ module ShellEv
13
13
  # @return [AccessibilityStatusEnum]
14
14
  attr_accessor :status
15
15
 
16
- # optional Arbitrary text about restrictions of the Location
17
- # @return [String]
18
- attr_accessor :remark
19
-
20
16
  # A mapping from model property names to API property names.
21
17
  def self.names
22
18
  @_hash = {} if @_hash.nil?
23
19
  @_hash['status'] = 'status'
24
- @_hash['remark'] = 'remark'
25
20
  @_hash
26
21
  end
27
22
 
@@ -29,7 +24,6 @@ module ShellEv
29
24
  def self.optionals
30
25
  %w[
31
26
  status
32
- remark
33
27
  ]
34
28
  end
35
29
 
@@ -38,9 +32,8 @@ module ShellEv
38
32
  []
39
33
  end
40
34
 
41
- def initialize(status = SKIP, remark = SKIP)
35
+ def initialize(status = SKIP)
42
36
  @status = status unless status == SKIP
43
- @remark = remark unless remark == SKIP
44
37
  end
45
38
 
46
39
  # Creates an instance of the object from a hash.
@@ -49,23 +42,21 @@ module ShellEv
49
42
 
50
43
  # Extract variables from the hash.
51
44
  status = hash.key?('status') ? hash['status'] : SKIP
52
- remark = hash.key?('remark') ? hash['remark'] : SKIP
53
45
 
54
46
  # Create object from extracted values.
55
- Accessibility.new(status,
56
- remark)
47
+ AccessibilityV2.new(status)
57
48
  end
58
49
 
59
50
  # Provides a human-readable string representation of the object.
60
51
  def to_s
61
52
  class_name = self.class.name.split('::').last
62
- "<#{class_name} status: #{@status}, remark: #{@remark}>"
53
+ "<#{class_name} status: #{@status}>"
63
54
  end
64
55
 
65
56
  # Provides a debugging-friendly string with detailed object information.
66
57
  def inspect
67
58
  class_name = self.class.name.split('::').last
68
- "<#{class_name} status: #{@status.inspect}, remark: #{@remark.inspect}>"
59
+ "<#{class_name} status: #{@status.inspect}>"
69
60
  end
70
61
  end
71
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
  # ActiveResponse200Json Model.
@@ -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
  # Indicates overall status of the request
@@ -19,5 +19,18 @@ module ShellEv
19
19
 
20
20
  ACTIVE_RESPONSE200_JSON_STATUS_ENUM.include?(value)
21
21
  end
22
+
23
+ def self.from_value(value, default_value = SUCCESS)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'success' then SUCCESS
30
+ when 'failed' then FAILED
31
+ else
32
+ default_value
33
+ end
34
+ end
22
35
  end
23
36
  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
  # Address of the Shell Recharge Location
@@ -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
  # BadRequestErrMsg Model.
@@ -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
  # Base model.
@@ -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
  # ChargeError Model.
@@ -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
  # ChargeRetrieveState Model.
@@ -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
  # ChargesessionStartBody Model.
@@ -0,0 +1,100 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ShellEv
7
+ # connectorTypes.
8
+ class ConnectorTypesEnum
9
+ CONNECTOR_TYPES_ENUM = [
10
+ # TODO: Write general description for AVCON
11
+ AVCON = 'Avcon'.freeze,
12
+
13
+ # TODO: Write general description for DOMESTIC
14
+ DOMESTIC = 'Domestic'.freeze,
15
+
16
+ # TODO: Write general description for INDUSTRIAL2PDC
17
+ INDUSTRIAL2PDC = 'Industrial2PDc'.freeze,
18
+
19
+ # TODO: Write general description for INDUSTRIALPNEAC
20
+ INDUSTRIALPNEAC = 'IndustrialPneAc'.freeze,
21
+
22
+ # TODO: Write general description for INDUSTRIAL3PEAC
23
+ INDUSTRIAL3PEAC = 'Industrial3PEAc'.freeze,
24
+
25
+ # TODO: Write general description for INDUSTRIAL3PENAC
26
+ INDUSTRIAL3PENAC = 'Industrial3PENAc'.freeze,
27
+
28
+ # TODO: Write general description for TYPE1
29
+ TYPE1 = 'Type1'.freeze,
30
+
31
+ # TODO: Write general description for TYPE1COMBO
32
+ TYPE1COMBO = 'Type1Combo'.freeze,
33
+
34
+ # TODO: Write general description for TYPE2
35
+ TYPE2 = 'Type2'.freeze,
36
+
37
+ # TODO: Write general description for TYPE2COMBO
38
+ TYPE2COMBO = 'Type2Combo'.freeze,
39
+
40
+ # TODO: Write general description for TYPE3
41
+ TYPE3 = 'Type3'.freeze,
42
+
43
+ # TODO: Write general description for LPI
44
+ LPI = 'LPI'.freeze,
45
+
46
+ # TODO: Write general description for NEMA520
47
+ NEMA520 = 'Nema520'.freeze,
48
+
49
+ # TODO: Write general description for SAEJ1772
50
+ SAEJ1772 = 'SAEJ1772'.freeze,
51
+
52
+ # TODO: Write general description for SPI
53
+ SPI = 'SPI'.freeze,
54
+
55
+ # TODO: Write general description for TEPCOCHADEMO
56
+ TEPCOCHADEMO = 'TepcoCHAdeMO'.freeze,
57
+
58
+ # TODO: Write general description for TESLA
59
+ TESLA = 'Tesla'.freeze,
60
+
61
+ # TODO: Write general description for UNSPECIFIED
62
+ UNSPECIFIED = 'Unspecified'.freeze
63
+ ].freeze
64
+
65
+ def self.validate(value)
66
+ return false if value.nil?
67
+
68
+ CONNECTOR_TYPES_ENUM.include?(value)
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
99
+ end
100
+ end
@@ -0,0 +1,95 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ShellEv
7
+ # An EVSE can have one or many Connectors. Each Connector will normally have a
8
+ # different socket / cable and only one can be used to charge at a time.
9
+ class ConnectorV2 < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Internal identifier used to refer to this Connector
14
+ # @return [String]
15
+ attr_accessor :uid
16
+
17
+ # Identifier of the Evse as given by the Operator, unique for the containing
18
+ # EVSE'
19
+ # @return [String]
20
+ attr_accessor :external_id
21
+
22
+ # Type of the connector in the EVSE unit.
23
+ # @return [ConnectorVOConnectorTypeEnum]
24
+ attr_accessor :connector_type
25
+
26
+ # Electrical Properties of the Connector
27
+ # @return [ElectricalPropertiesV2]
28
+ attr_accessor :electrical_properties
29
+
30
+ # A mapping from model property names to API property names.
31
+ def self.names
32
+ @_hash = {} if @_hash.nil?
33
+ @_hash['uid'] = 'uid'
34
+ @_hash['external_id'] = 'externalId'
35
+ @_hash['connector_type'] = 'connectorType'
36
+ @_hash['electrical_properties'] = 'electricalProperties'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ %w[
43
+ uid
44
+ external_id
45
+ connector_type
46
+ electrical_properties
47
+ ]
48
+ end
49
+
50
+ # An array for nullable fields
51
+ def self.nullables
52
+ []
53
+ end
54
+
55
+ def initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP,
56
+ electrical_properties = SKIP)
57
+ @uid = uid unless uid == SKIP
58
+ @external_id = external_id unless external_id == SKIP
59
+ @connector_type = connector_type unless connector_type == SKIP
60
+ @electrical_properties = electrical_properties unless electrical_properties == SKIP
61
+ end
62
+
63
+ # Creates an instance of the object from a hash.
64
+ def self.from_hash(hash)
65
+ return nil unless hash
66
+
67
+ # Extract variables from the hash.
68
+ uid = hash.key?('uid') ? hash['uid'] : SKIP
69
+ external_id = hash.key?('externalId') ? hash['externalId'] : SKIP
70
+ connector_type = hash.key?('connectorType') ? hash['connectorType'] : SKIP
71
+ electrical_properties = ElectricalPropertiesV2.from_hash(hash['electricalProperties']) if
72
+ hash['electricalProperties']
73
+
74
+ # Create object from extracted values.
75
+ ConnectorV2.new(uid,
76
+ external_id,
77
+ connector_type,
78
+ electrical_properties)
79
+ end
80
+
81
+ # Provides a human-readable string representation of the object.
82
+ def to_s
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} uid: #{@uid}, external_id: #{@external_id}, connector_type:"\
85
+ " #{@connector_type}, electrical_properties: #{@electrical_properties}>"
86
+ end
87
+
88
+ # Provides a debugging-friendly string with detailed object information.
89
+ def inspect
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} uid: #{@uid.inspect}, external_id: #{@external_id.inspect}, connector_type:"\
92
+ " #{@connector_type.inspect}, electrical_properties: #{@electrical_properties.inspect}>"
93
+ end
94
+ end
95
+ 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
  # Type of the connector in the EVSE unit.
@@ -67,5 +67,34 @@ module ShellEv
67
67
 
68
68
  CONNECTOR_VO_CONNECTOR_TYPE_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
  # Source of the last update
@@ -25,5 +25,20 @@ module ShellEv
25
25
 
26
26
  CONNECTOR_VO_UPDATED_BY_ENUM.include?(value)
27
27
  end
28
+
29
+ def self.from_value(value, default_value = FEED)
30
+ return default_value if value.nil?
31
+
32
+ str = value.to_s.strip
33
+
34
+ case str.downcase
35
+ when 'feed' then FEED
36
+ when 'admin' then ADMIN
37
+ when 'tariffservice' then TARIFFSERVICE
38
+ when 'defaults' then DEFAULTS
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
  # Coordinates of the Shell Recharge Site Location