ev-recharge-sdk 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -21
  3. data/lib/shell_ev/client.rb +8 -8
  4. data/lib/shell_ev/configuration.rb +13 -17
  5. data/lib/shell_ev/controllers/base_controller.rb +9 -9
  6. data/lib/shell_ev/controllers/charging_controller.rb +121 -154
  7. data/lib/shell_ev/controllers/locations_controller.rb +226 -142
  8. data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +8 -8
  9. data/lib/shell_ev/exceptions/bad_request_exception.rb +33 -18
  10. data/lib/shell_ev/exceptions/{m405_error_response_error1_exception.rb → internal_server_error_exception.rb} +31 -26
  11. data/lib/shell_ev/exceptions/not_found_exception.rb +36 -19
  12. data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +15 -15
  13. data/lib/shell_ev/exceptions/{m400_error_response_error1_exception.rb → serviceunavailable_exception.rb} +28 -28
  14. data/lib/shell_ev/exceptions/{m401_error_response_error1_exception.rb → too_many_requests_exception.rb} +28 -28
  15. data/lib/shell_ev/exceptions/unauthorized_exception.rb +32 -18
  16. data/lib/shell_ev/http/auth/o_auth2.rb +54 -10
  17. data/lib/shell_ev/models/accessibility.rb +1 -2
  18. data/lib/shell_ev/models/active_response200_json.rb +11 -13
  19. data/lib/shell_ev/models/address.rb +1 -3
  20. data/lib/shell_ev/models/bad_request_err_msg.rb +82 -0
  21. data/lib/shell_ev/models/{stop_charge_session_request_body_json.rb → charge_error.rb} +21 -10
  22. data/lib/shell_ev/models/charge_retrieve_state.rb +63 -0
  23. data/lib/shell_ev/models/chargesession_start_body.rb +7 -9
  24. data/lib/shell_ev/models/connector_vo.rb +4 -9
  25. data/lib/shell_ev/models/coordinates.rb +1 -2
  26. data/lib/shell_ev/models/data_active.rb +27 -45
  27. data/lib/shell_ev/models/data_retrieve.rb +31 -49
  28. data/lib/shell_ev/models/electrical_properties.rb +1 -3
  29. data/lib/shell_ev/models/evse_vo.rb +3 -8
  30. data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +11 -13
  31. data/lib/shell_ev/models/{get_markers_list_authorization_methods_enum.rb → get_ev_locations_authorization_methods_enum.rb} +4 -4
  32. data/lib/shell_ev/models/{get_markers_list_connector_types_enum.rb → get_ev_locations_connector_types_enum.rb} +4 -4
  33. data/lib/shell_ev/models/{get_markers_list_evse_status_enum.rb → get_ev_locations_evse_status_enum.rb} +4 -4
  34. data/lib/shell_ev/models/inline_response202.rb +9 -11
  35. data/lib/shell_ev/models/inline_response2021.rb +5 -6
  36. data/lib/shell_ev/models/inline_response202_data.rb +7 -5
  37. data/lib/shell_ev/models/internal_error_object.rb +70 -0
  38. data/lib/shell_ev/models/location_respone_object.rb +4 -11
  39. data/lib/shell_ev/models/{get_locations_list_authorization_methods_enum.rb → locations_markers_authorization_methods_enum.rb} +4 -4
  40. data/lib/shell_ev/models/{get_locations_list_connector_types_enum.rb → locations_markers_connector_types_enum.rb} +4 -4
  41. data/lib/shell_ev/models/{get_locations_list_evse_status_enum.rb → locations_markers_evse_status_enum.rb} +4 -4
  42. data/lib/shell_ev/models/multi_location_marker.rb +2 -6
  43. data/lib/shell_ev/models/{get_nearby_locations_authorization_methods_enum.rb → nearby_locations_authorization_methods_enum.rb} +4 -4
  44. data/lib/shell_ev/models/{get_nearby_locations_connector_types_enum.rb → nearby_locations_connector_types_enum.rb} +4 -4
  45. data/lib/shell_ev/models/{get_nearby_locations_evse_status_enum.rb → nearby_locations_evse_status_enum.rb} +4 -4
  46. data/lib/shell_ev/models/not_found_err_msg.rb +82 -0
  47. data/lib/shell_ev/models/o_auth_token.rb +2 -6
  48. data/lib/shell_ev/models/opening_hours_object.rb +1 -3
  49. data/lib/shell_ev/models/ratelimit_err_msg.rb +82 -0
  50. data/lib/shell_ev/models/response.rb +78 -0
  51. data/lib/shell_ev/models/serviceunavailable_err_msg.rb +82 -0
  52. data/lib/shell_ev/models/single_location_marker.rb +5 -11
  53. data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +1 -1
  54. data/lib/shell_ev/models/single_location_marker_response.rb +81 -0
  55. data/lib/shell_ev/models/tariff_vo.rb +3 -7
  56. data/lib/shell_ev/models/unauthorized_err_msg.rb +82 -0
  57. data/lib/shell_ev/utilities/file_wrapper.rb +9 -9
  58. data/lib/shell_ev/utilities/union_type_lookup.rb +3 -2
  59. data/lib/shell_ev.rb +40 -60
  60. data/test/controllers/controller_test_base.rb +0 -5
  61. data/test/controllers/test_charging_controller.rb +74 -17
  62. data/test/controllers/test_locations_controller.rb +65 -0
  63. metadata +31 -49
  64. data/lib/shell_ev/exceptions/http401_error_response_exception.rb +0 -52
  65. data/lib/shell_ev/exceptions/m404_error_response_error1_exception.rb +0 -53
  66. data/lib/shell_ev/exceptions/m429_error_response_error1_exception.rb +0 -52
  67. data/lib/shell_ev/exceptions/m500_error_response_error1_exception.rb +0 -52
  68. data/lib/shell_ev/exceptions/m503_error_response_error1_exception.rb +0 -52
  69. data/lib/shell_ev/models/data_active_session_code_enum.rb +0 -44
  70. data/lib/shell_ev/models/data_active_session_state_enum.rb +0 -35
  71. data/lib/shell_ev/models/data_retrieve_session_code_enum.rb +0 -44
  72. data/lib/shell_ev/models/data_retrieve_session_state_enum.rb +0 -35
  73. data/lib/shell_ev/models/env_enum.rb +0 -23
  74. data/lib/shell_ev/models/m400_error_response.rb +0 -78
  75. data/lib/shell_ev/models/m400_error_response_error.rb +0 -80
  76. data/lib/shell_ev/models/m401_error_response.rb +0 -78
  77. data/lib/shell_ev/models/m401_error_response_error.rb +0 -80
  78. data/lib/shell_ev/models/m404_error_response.rb +0 -79
  79. data/lib/shell_ev/models/m404_error_response_error.rb +0 -80
  80. data/lib/shell_ev/models/m405_error_response.rb +0 -78
  81. data/lib/shell_ev/models/m405_error_response_error.rb +0 -80
  82. data/lib/shell_ev/models/m429_error_response.rb +0 -78
  83. data/lib/shell_ev/models/m429_error_response_error.rb +0 -80
  84. data/lib/shell_ev/models/m500_error_response.rb +0 -78
  85. data/lib/shell_ev/models/m500_error_response_error.rb +0 -80
  86. data/lib/shell_ev/models/m503_error_response.rb +0 -78
  87. data/lib/shell_ev/models/m503_error_response_error.rb +0 -80
  88. data/lib/shell_ev/models/response_base_status_enum.rb +0 -26
  89. data/lib/shell_ev/models/response_error401_all_of1.rb +0 -57
  90. data/lib/shell_ev/models/response_error401_all_of1_errors_items.rb +0 -80
  91. data/lib/shell_ev/models/success_response.rb +0 -58
@@ -0,0 +1,82 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # BadRequestErrMsg Model.
8
+ class BadRequestErrMsg < BaseModel
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
+ # Technical details of the error message, the example which is given in the
21
+ # sample payload is one of the scenarios. actual response will vary based on
22
+ # the validation error
23
+ # @return [String]
24
+ attr_accessor :description
25
+
26
+ # Technical details of the error message, the example which is given in the
27
+ # sample payload is one of the scenarios. actual response will vary based on
28
+ # the validation error
29
+ # @return [Array[String]]
30
+ attr_accessor :details
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['code'] = 'code'
36
+ @_hash['message'] = 'message'
37
+ @_hash['description'] = 'description'
38
+ @_hash['details'] = 'details'
39
+ @_hash
40
+ end
41
+
42
+ # An array for optional fields
43
+ def self.optionals
44
+ %w[
45
+ code
46
+ message
47
+ description
48
+ details
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(code = SKIP, message = SKIP, description = SKIP,
58
+ details = SKIP)
59
+ @code = code unless code == SKIP
60
+ @message = message unless message == SKIP
61
+ @description = description unless description == SKIP
62
+ @details = details unless details == SKIP
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ code = hash.key?('code') ? hash['code'] : SKIP
71
+ message = hash.key?('message') ? hash['message'] : SKIP
72
+ description = hash.key?('description') ? hash['description'] : SKIP
73
+ details = hash.key?('details') ? hash['details'] : SKIP
74
+
75
+ # Create object from extracted values.
76
+ BadRequestErrMsg.new(code,
77
+ message,
78
+ description,
79
+ details)
80
+ end
81
+ end
82
+ end
@@ -4,25 +4,33 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module ShellEv
7
- # StopChargeSessionRequestBodyJson Model.
8
- class StopChargeSessionRequestBodyJson < BaseModel
7
+ # ChargeError Model.
8
+ class ChargeError < BaseModel
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # Session Id is to be fetched
12
+ # Session code e.g InternalError
13
13
  # @return [String]
14
- attr_accessor :sesssion_id
14
+ attr_accessor :code
15
+
16
+ # Session message
17
+ # @return [String]
18
+ attr_accessor :message
15
19
 
16
20
  # A mapping from model property names to API property names.
17
21
  def self.names
18
22
  @_hash = {} if @_hash.nil?
19
- @_hash['sesssion_id'] = 'SesssionId'
23
+ @_hash['code'] = 'code'
24
+ @_hash['message'] = 'message'
20
25
  @_hash
21
26
  end
22
27
 
23
28
  # An array for optional fields
24
29
  def self.optionals
25
- []
30
+ %w[
31
+ code
32
+ message
33
+ ]
26
34
  end
27
35
 
28
36
  # An array for nullable fields
@@ -30,8 +38,9 @@ module ShellEv
30
38
  []
31
39
  end
32
40
 
33
- def initialize(sesssion_id = nil)
34
- @sesssion_id = sesssion_id
41
+ def initialize(code = SKIP, message = SKIP)
42
+ @code = code unless code == SKIP
43
+ @message = message unless message == SKIP
35
44
  end
36
45
 
37
46
  # Creates an instance of the object from a hash.
@@ -39,10 +48,12 @@ module ShellEv
39
48
  return nil unless hash
40
49
 
41
50
  # Extract variables from the hash.
42
- sesssion_id = hash.key?('SesssionId') ? hash['SesssionId'] : nil
51
+ code = hash.key?('code') ? hash['code'] : SKIP
52
+ message = hash.key?('message') ? hash['message'] : SKIP
43
53
 
44
54
  # Create object from extracted values.
45
- StopChargeSessionRequestBodyJson.new(sesssion_id)
55
+ ChargeError.new(code,
56
+ message)
46
57
  end
47
58
  end
48
59
  end
@@ -0,0 +1,63 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # ChargeRetrieveState Model.
8
+ class ChargeRetrieveState < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Describes the session state
13
+ # started, stopped, start-requested, stop-requested, failed-to-start,
14
+ # failed-to-stop
15
+ # @return [String]
16
+ attr_accessor :status
17
+
18
+ # Describes the session state
19
+ # started, stopped, start-requested, stop-requested, failed-to-start,
20
+ # failed-to-stop
21
+ # @return [ChargeError]
22
+ attr_accessor :error
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['status'] = 'status'
28
+ @_hash['error'] = 'error'
29
+ @_hash
30
+ end
31
+
32
+ # An array for optional fields
33
+ def self.optionals
34
+ %w[
35
+ status
36
+ error
37
+ ]
38
+ end
39
+
40
+ # An array for nullable fields
41
+ def self.nullables
42
+ []
43
+ end
44
+
45
+ def initialize(status = SKIP, error = SKIP)
46
+ @status = status unless status == SKIP
47
+ @error = error unless error == SKIP
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ status = hash.key?('status') ? hash['status'] : SKIP
56
+ error = ChargeError.from_hash(hash['error']) if hash['error']
57
+
58
+ # Create object from extracted values.
59
+ ChargeRetrieveState.new(status,
60
+ error)
61
+ end
62
+ end
63
+ end
@@ -9,20 +9,19 @@ module ShellEv
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
12
- # The EV Charge Number which can be found on the back of the Shell EV Card
12
+ # Ev charge number
13
13
  # @return [String]
14
14
  attr_accessor :ev_charge_number
15
15
 
16
- # Standard EVSE (Electric Vehicle Supply Equipment) Id identifier
17
- # (ISO-IEC-15118)
16
+ # This is the Electric Vehicle EquipmentID
18
17
  # @return [String]
19
18
  attr_accessor :evse_id
20
19
 
21
20
  # A mapping from model property names to API property names.
22
21
  def self.names
23
22
  @_hash = {} if @_hash.nil?
24
- @_hash['ev_charge_number'] = 'EvChargeNumber'
25
- @_hash['evse_id'] = 'EvseId'
23
+ @_hash['ev_charge_number'] = 'evChargeNumber'
24
+ @_hash['evse_id'] = 'evseId'
26
25
  @_hash
27
26
  end
28
27
 
@@ -36,8 +35,7 @@ module ShellEv
36
35
  []
37
36
  end
38
37
 
39
- def initialize(ev_charge_number = nil,
40
- evse_id = nil)
38
+ def initialize(ev_charge_number = nil, evse_id = nil)
41
39
  @ev_charge_number = ev_charge_number
42
40
  @evse_id = evse_id
43
41
  end
@@ -48,8 +46,8 @@ module ShellEv
48
46
 
49
47
  # Extract variables from the hash.
50
48
  ev_charge_number =
51
- hash.key?('EvChargeNumber') ? hash['EvChargeNumber'] : nil
52
- evse_id = hash.key?('EvseId') ? hash['EvseId'] : nil
49
+ hash.key?('evChargeNumber') ? hash['evChargeNumber'] : nil
50
+ evse_id = hash.key?('evseId') ? hash['evseId'] : nil
53
51
 
54
52
  # Create object from extracted values.
55
53
  ChargesessionStartBody.new(ev_charge_number,
@@ -36,7 +36,7 @@ module ShellEv
36
36
  # @return [TariffVO]
37
37
  attr_accessor :tariff
38
38
 
39
- # ISO8601-compliant UTC datetime of the last update of the Connectors's data
39
+ # ISO8601-compliant UTC datetime of the last update of the Connector’s data
40
40
  # @return [String]
41
41
  attr_accessor :updated
42
42
 
@@ -83,14 +83,9 @@ module ShellEv
83
83
  []
84
84
  end
85
85
 
86
- def initialize(uid = SKIP,
87
- external_id = SKIP,
88
- connector_type = SKIP,
89
- electrical_properties = SKIP,
90
- fixed_cable = SKIP,
91
- tariff = SKIP,
92
- updated = SKIP,
93
- updated_by = SKIP,
86
+ def initialize(uid = SKIP, external_id = SKIP, connector_type = SKIP,
87
+ electrical_properties = SKIP, fixed_cable = SKIP,
88
+ tariff = SKIP, updated = SKIP, updated_by = SKIP,
94
89
  deleted = SKIP)
95
90
  @uid = uid unless uid == SKIP
96
91
  @external_id = external_id unless external_id == SKIP
@@ -38,8 +38,7 @@ module ShellEv
38
38
  []
39
39
  end
40
40
 
41
- def initialize(latitude = SKIP,
42
- longitude = SKIP)
41
+ def initialize(latitude = SKIP, longitude = SKIP)
43
42
  @latitude = latitude unless latitude == SKIP
44
43
  @longitude = longitude unless longitude == SKIP
45
44
  end
@@ -35,30 +35,25 @@ module ShellEv
35
35
  # @return [DateTime]
36
36
  attr_accessor :stopped_at
37
37
 
38
- # Describes the session state
39
- # @return [DataActiveSessionStateEnum]
38
+ # When the session is stopped
39
+ # @return [ChargeRetrieveState]
40
40
  attr_accessor :session_state
41
41
 
42
- # Session code e.g InternalError
43
- # @return [DataActiveSessionCodeEnum]
44
- attr_accessor :session_code
45
-
46
- # Session message
42
+ # When the session is stopped
47
43
  # @return [String]
48
- attr_accessor :session_message
44
+ attr_accessor :last_updated
49
45
 
50
46
  # A mapping from model property names to API property names.
51
47
  def self.names
52
48
  @_hash = {} if @_hash.nil?
53
- @_hash['id'] = 'Id'
54
- @_hash['user_id'] = 'UserId'
55
- @_hash['ema_id'] = 'EmaId'
56
- @_hash['evse_id'] = 'EvseId'
57
- @_hash['started_at'] = 'StartedAt'
58
- @_hash['stopped_at'] = 'StoppedAt'
49
+ @_hash['id'] = 'id'
50
+ @_hash['user_id'] = 'userId'
51
+ @_hash['ema_id'] = 'emaId'
52
+ @_hash['evse_id'] = 'evseId'
53
+ @_hash['started_at'] = 'startedAt'
54
+ @_hash['stopped_at'] = 'stoppedAt'
59
55
  @_hash['session_state'] = 'SessionState'
60
- @_hash['session_code'] = 'SessionCode'
61
- @_hash['session_message'] = 'SessionMessage'
56
+ @_hash['last_updated'] = 'lastUpdated'
62
57
  @_hash
63
58
  end
64
59
 
@@ -72,8 +67,7 @@ module ShellEv
72
67
  started_at
73
68
  stopped_at
74
69
  session_state
75
- session_code
76
- session_message
70
+ last_updated
77
71
  ]
78
72
  end
79
73
 
@@ -81,20 +75,12 @@ module ShellEv
81
75
  def self.nullables
82
76
  %w[
83
77
  stopped_at
84
- session_code
85
- session_message
86
78
  ]
87
79
  end
88
80
 
89
- def initialize(id = SKIP,
90
- user_id = SKIP,
91
- ema_id = SKIP,
92
- evse_id = SKIP,
93
- started_at = SKIP,
94
- stopped_at = SKIP,
95
- session_state = SKIP,
96
- session_code = SKIP,
97
- session_message = SKIP)
81
+ def initialize(id = SKIP, user_id = SKIP, ema_id = SKIP, evse_id = SKIP,
82
+ started_at = SKIP, stopped_at = SKIP, session_state = SKIP,
83
+ last_updated = SKIP)
98
84
  @id = id unless id == SKIP
99
85
  @user_id = user_id unless user_id == SKIP
100
86
  @ema_id = ema_id unless ema_id == SKIP
@@ -102,8 +88,7 @@ module ShellEv
102
88
  @started_at = started_at unless started_at == SKIP
103
89
  @stopped_at = stopped_at unless stopped_at == SKIP
104
90
  @session_state = session_state unless session_state == SKIP
105
- @session_code = session_code unless session_code == SKIP
106
- @session_message = session_message unless session_message == SKIP
91
+ @last_updated = last_updated unless last_updated == SKIP
107
92
  end
108
93
 
109
94
  # Creates an instance of the object from a hash.
@@ -111,24 +96,22 @@ module ShellEv
111
96
  return nil unless hash
112
97
 
113
98
  # Extract variables from the hash.
114
- id = hash.key?('Id') ? hash['Id'] : SKIP
115
- user_id = hash.key?('UserId') ? hash['UserId'] : SKIP
116
- ema_id = hash.key?('EmaId') ? hash['EmaId'] : SKIP
117
- evse_id = hash.key?('EvseId') ? hash['EvseId'] : SKIP
118
- started_at = if hash.key?('StartedAt')
119
- (DateTimeHelper.from_rfc3339(hash['StartedAt']) if hash['StartedAt'])
99
+ id = hash.key?('id') ? hash['id'] : SKIP
100
+ user_id = hash.key?('userId') ? hash['userId'] : SKIP
101
+ ema_id = hash.key?('emaId') ? hash['emaId'] : SKIP
102
+ evse_id = hash.key?('evseId') ? hash['evseId'] : SKIP
103
+ started_at = if hash.key?('startedAt')
104
+ (DateTimeHelper.from_rfc3339(hash['startedAt']) if hash['startedAt'])
120
105
  else
121
106
  SKIP
122
107
  end
123
- stopped_at = if hash.key?('StoppedAt')
124
- (DateTimeHelper.from_rfc3339(hash['StoppedAt']) if hash['StoppedAt'])
108
+ stopped_at = if hash.key?('stoppedAt')
109
+ (DateTimeHelper.from_rfc3339(hash['stoppedAt']) if hash['stoppedAt'])
125
110
  else
126
111
  SKIP
127
112
  end
128
- session_state = hash.key?('SessionState') ? hash['SessionState'] : SKIP
129
- session_code = hash.key?('SessionCode') ? hash['SessionCode'] : SKIP
130
- session_message =
131
- hash.key?('SessionMessage') ? hash['SessionMessage'] : SKIP
113
+ session_state = ChargeRetrieveState.from_hash(hash['SessionState']) if hash['SessionState']
114
+ last_updated = hash.key?('lastUpdated') ? hash['lastUpdated'] : SKIP
132
115
 
133
116
  # Create object from extracted values.
134
117
  DataActive.new(id,
@@ -138,8 +121,7 @@ module ShellEv
138
121
  started_at,
139
122
  stopped_at,
140
123
  session_state,
141
- session_code,
142
- session_message)
124
+ last_updated)
143
125
  end
144
126
 
145
127
  def to_custom_started_at
@@ -26,6 +26,10 @@ module ShellEv
26
26
  # @return [String]
27
27
  attr_accessor :evse_id
28
28
 
29
+ # Last updated date
30
+ # @return [String]
31
+ attr_accessor :last_updated
32
+
29
33
  # When the session is started
30
34
  # @return [DateTime]
31
35
  attr_accessor :started_at
@@ -34,30 +38,21 @@ module ShellEv
34
38
  # @return [DateTime]
35
39
  attr_accessor :stopped_at
36
40
 
37
- # Describes the session state
38
- # @return [DataRetrieveSessionStateEnum]
41
+ # When the session is stopped
42
+ # @return [ChargeRetrieveState]
39
43
  attr_accessor :session_state
40
44
 
41
- # Session code e.g InternalError
42
- # @return [DataRetrieveSessionCodeEnum]
43
- attr_accessor :session_code
44
-
45
- # Session message
46
- # @return [String]
47
- attr_accessor :session_message
48
-
49
45
  # A mapping from model property names to API property names.
50
46
  def self.names
51
47
  @_hash = {} if @_hash.nil?
52
- @_hash['id'] = 'Id'
53
- @_hash['user_id'] = 'UserId'
54
- @_hash['ema_id'] = 'EmaId'
55
- @_hash['evse_id'] = 'EvseId'
56
- @_hash['started_at'] = 'StartedAt'
57
- @_hash['stopped_at'] = 'StoppedAt'
58
- @_hash['session_state'] = 'SessionState'
59
- @_hash['session_code'] = 'SessionCode'
60
- @_hash['session_message'] = 'SessionMessage'
48
+ @_hash['id'] = 'id'
49
+ @_hash['user_id'] = 'userId'
50
+ @_hash['ema_id'] = 'emaId'
51
+ @_hash['evse_id'] = 'evseId'
52
+ @_hash['last_updated'] = 'lastUpdated'
53
+ @_hash['started_at'] = 'startedAt'
54
+ @_hash['stopped_at'] = 'stoppedAt'
55
+ @_hash['session_state'] = 'sessionState'
61
56
  @_hash
62
57
  end
63
58
 
@@ -68,11 +63,10 @@ module ShellEv
68
63
  user_id
69
64
  ema_id
70
65
  evse_id
66
+ last_updated
71
67
  started_at
72
68
  stopped_at
73
69
  session_state
74
- session_code
75
- session_message
76
70
  ]
77
71
  end
78
72
 
@@ -80,29 +74,20 @@ module ShellEv
80
74
  def self.nullables
81
75
  %w[
82
76
  stopped_at
83
- session_code
84
- session_message
85
77
  ]
86
78
  end
87
79
 
88
- def initialize(id = SKIP,
89
- user_id = SKIP,
90
- ema_id = SKIP,
91
- evse_id = SKIP,
92
- started_at = SKIP,
93
- stopped_at = SKIP,
94
- session_state = SKIP,
95
- session_code = SKIP,
96
- session_message = SKIP)
80
+ def initialize(id = SKIP, user_id = SKIP, ema_id = SKIP, evse_id = SKIP,
81
+ last_updated = SKIP, started_at = SKIP, stopped_at = SKIP,
82
+ session_state = SKIP)
97
83
  @id = id unless id == SKIP
98
84
  @user_id = user_id unless user_id == SKIP
99
85
  @ema_id = ema_id unless ema_id == SKIP
100
86
  @evse_id = evse_id unless evse_id == SKIP
87
+ @last_updated = last_updated unless last_updated == SKIP
101
88
  @started_at = started_at unless started_at == SKIP
102
89
  @stopped_at = stopped_at unless stopped_at == SKIP
103
90
  @session_state = session_state unless session_state == SKIP
104
- @session_code = session_code unless session_code == SKIP
105
- @session_message = session_message unless session_message == SKIP
106
91
  end
107
92
 
108
93
  # Creates an instance of the object from a hash.
@@ -110,35 +95,32 @@ module ShellEv
110
95
  return nil unless hash
111
96
 
112
97
  # Extract variables from the hash.
113
- id = hash.key?('Id') ? hash['Id'] : SKIP
114
- user_id = hash.key?('UserId') ? hash['UserId'] : SKIP
115
- ema_id = hash.key?('EmaId') ? hash['EmaId'] : SKIP
116
- evse_id = hash.key?('EvseId') ? hash['EvseId'] : SKIP
117
- started_at = if hash.key?('StartedAt')
118
- (DateTimeHelper.from_rfc3339(hash['StartedAt']) if hash['StartedAt'])
98
+ id = hash.key?('id') ? hash['id'] : SKIP
99
+ user_id = hash.key?('userId') ? hash['userId'] : SKIP
100
+ ema_id = hash.key?('emaId') ? hash['emaId'] : SKIP
101
+ evse_id = hash.key?('evseId') ? hash['evseId'] : SKIP
102
+ last_updated = hash.key?('lastUpdated') ? hash['lastUpdated'] : SKIP
103
+ started_at = if hash.key?('startedAt')
104
+ (DateTimeHelper.from_rfc3339(hash['startedAt']) if hash['startedAt'])
119
105
  else
120
106
  SKIP
121
107
  end
122
- stopped_at = if hash.key?('StoppedAt')
123
- (DateTimeHelper.from_rfc3339(hash['StoppedAt']) if hash['StoppedAt'])
108
+ stopped_at = if hash.key?('stoppedAt')
109
+ (DateTimeHelper.from_rfc3339(hash['stoppedAt']) if hash['stoppedAt'])
124
110
  else
125
111
  SKIP
126
112
  end
127
- session_state = hash.key?('SessionState') ? hash['SessionState'] : SKIP
128
- session_code = hash.key?('SessionCode') ? hash['SessionCode'] : SKIP
129
- session_message =
130
- hash.key?('SessionMessage') ? hash['SessionMessage'] : SKIP
113
+ session_state = ChargeRetrieveState.from_hash(hash['sessionState']) if hash['sessionState']
131
114
 
132
115
  # Create object from extracted values.
133
116
  DataRetrieve.new(id,
134
117
  user_id,
135
118
  ema_id,
136
119
  evse_id,
120
+ last_updated,
137
121
  started_at,
138
122
  stopped_at,
139
- session_state,
140
- session_code,
141
- session_message)
123
+ session_state)
142
124
  end
143
125
 
144
126
  def to_custom_started_at
@@ -50,9 +50,7 @@ module ShellEv
50
50
  []
51
51
  end
52
52
 
53
- def initialize(power_type = SKIP,
54
- voltage = SKIP,
55
- amperage = SKIP,
53
+ def initialize(power_type = SKIP, voltage = SKIP, amperage = SKIP,
56
54
  max_electric_power = SKIP)
57
55
  @power_type = power_type unless power_type == SKIP
58
56
  @voltage = voltage unless voltage == SKIP
@@ -82,14 +82,9 @@ module ShellEv
82
82
  []
83
83
  end
84
84
 
85
- def initialize(uid = SKIP,
86
- external_id = SKIP,
87
- evse_id = SKIP,
88
- status = SKIP,
89
- connectors = SKIP,
90
- authorization_methods = SKIP,
91
- updated = SKIP,
92
- deleted = SKIP,
85
+ def initialize(uid = SKIP, external_id = SKIP, evse_id = SKIP,
86
+ status = SKIP, connectors = SKIP,
87
+ authorization_methods = SKIP, updated = SKIP, deleted = SKIP,
93
88
  physical_reference = SKIP)
94
89
  @uid = uid unless uid == SKIP
95
90
  @external_id = external_id unless external_id == SKIP
@@ -9,8 +9,8 @@ module ShellEv
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
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.
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
14
  # @return [UUID | String]
15
15
  attr_accessor :request_id
16
16
 
@@ -25,9 +25,9 @@ module ShellEv
25
25
  # A mapping from model property names to API property names.
26
26
  def self.names
27
27
  @_hash = {} if @_hash.nil?
28
- @_hash['request_id'] = 'RequestId'
29
- @_hash['status'] = 'Status'
30
- @_hash['data'] = 'Data'
28
+ @_hash['request_id'] = 'requestId'
29
+ @_hash['status'] = 'status'
30
+ @_hash['data'] = 'data'
31
31
  @_hash
32
32
  end
33
33
 
@@ -43,9 +43,7 @@ module ShellEv
43
43
  []
44
44
  end
45
45
 
46
- def initialize(request_id = nil,
47
- status = nil,
48
- data = SKIP)
46
+ def initialize(request_id = nil, status = nil, data = SKIP)
49
47
  @request_id = request_id
50
48
  @status = status
51
49
  @data = data unless data == SKIP
@@ -56,18 +54,18 @@ module ShellEv
56
54
  return nil unless hash
57
55
 
58
56
  # Extract variables from the hash.
59
- request_id = hash.key?('RequestId') ? hash['RequestId'] : nil
60
- status = hash.key?('Status') ? hash['Status'] : nil
57
+ request_id = hash.key?('requestId') ? hash['requestId'] : nil
58
+ status = hash.key?('status') ? hash['status'] : nil
61
59
  # Parameter is an array, so we need to iterate through it
62
60
  data = nil
63
- unless hash['Data'].nil?
61
+ unless hash['data'].nil?
64
62
  data = []
65
- hash['Data'].each do |structure|
63
+ hash['data'].each do |structure|
66
64
  data << (DataRetrieve.from_hash(structure) if structure)
67
65
  end
68
66
  end
69
67
 
70
- data = SKIP unless hash.key?('Data')
68
+ data = SKIP unless hash.key?('data')
71
69
 
72
70
  # Create object from extracted values.
73
71
  GetChargeSessionRetrieveResponse200Json.new(request_id,