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,81 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # Address of the Shell Recharge Location
8
+ class Address < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Street Name and Number of the Shell Recharge Location
13
+ # @return [String]
14
+ attr_accessor :street_and_number
15
+
16
+ # Postal Code of the Shell Recharge Location
17
+ # @return [String]
18
+ attr_accessor :postal_code
19
+
20
+ # City name of the Shell Recharge Location
21
+ # @return [String]
22
+ attr_accessor :city
23
+
24
+ # ISO 3166 Alpha-2 Country Code of the Shell Recharge Location
25
+ # @return [String]
26
+ attr_accessor :country
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['street_and_number'] = 'streetAndNumber'
32
+ @_hash['postal_code'] = 'postalCode'
33
+ @_hash['city'] = 'city'
34
+ @_hash['country'] = 'country'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ street_and_number
42
+ postal_code
43
+ city
44
+ country
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(street_and_number = SKIP,
54
+ postal_code = SKIP,
55
+ city = SKIP,
56
+ country = SKIP)
57
+ @street_and_number = street_and_number unless street_and_number == SKIP
58
+ @postal_code = postal_code unless postal_code == SKIP
59
+ @city = city unless city == SKIP
60
+ @country = country unless country == 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
+ street_and_number =
69
+ hash.key?('streetAndNumber') ? hash['streetAndNumber'] : SKIP
70
+ postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
71
+ city = hash.key?('city') ? hash['city'] : SKIP
72
+ country = hash.key?('country') ? hash['country'] : SKIP
73
+
74
+ # Create object from extracted values.
75
+ Address.new(street_and_number,
76
+ postal_code,
77
+ city,
78
+ country)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,62 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # Base model.
8
+ class BaseModel < CoreLibrary::BaseModel
9
+ # Returns a Hash representation of the current object.
10
+ def to_hash
11
+ # validating the model being serialized
12
+ self.class.validate(self) if self.class.respond_to?(:validate)
13
+
14
+ hash = {}
15
+ instance_variables.each do |name|
16
+ value = instance_variable_get(name)
17
+ name = name[1..]
18
+ key = self.class.names.key?(name) ? self.class.names[name] : name
19
+ optional_fields = self.class.optionals
20
+ nullable_fields = self.class.nullables
21
+ if value.nil?
22
+ next unless nullable_fields.include?(name)
23
+
24
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
25
+ raise ArgumentError,
26
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
27
+ end
28
+ end
29
+
30
+ hash[key] = nil
31
+ unless value.nil?
32
+ if respond_to?("to_custom_#{name}")
33
+ if (value.instance_of? Array) || (value.instance_of? Hash)
34
+ params = [hash, key]
35
+ hash[key] = send("to_custom_#{name}", *params)
36
+ else
37
+ hash[key] = send("to_custom_#{name}")
38
+ end
39
+ elsif respond_to?("to_union_type_#{name}")
40
+ hash[key] = send("to_union_type_#{name}")
41
+ elsif value.instance_of? Array
42
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
43
+ elsif value.instance_of? Hash
44
+ hash[key] = {}
45
+ value.each do |k, v|
46
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
47
+ end
48
+ else
49
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
50
+ end
51
+ end
52
+ end
53
+ hash
54
+ end
55
+
56
+ # Returns a JSON representation of the curent object.
57
+ def to_json(options = {})
58
+ hash = to_hash
59
+ hash.to_json(options)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,59 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # ChargesessionStartBody Model.
8
+ class ChargesessionStartBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The EV Charge Number which can be found on the back of the Shell EV Card
13
+ # @return [String]
14
+ attr_accessor :ev_charge_number
15
+
16
+ # Standard EVSE (Electric Vehicle Supply Equipment) Id identifier
17
+ # (ISO-IEC-15118)
18
+ # @return [String]
19
+ attr_accessor :evse_id
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['ev_charge_number'] = 'EvChargeNumber'
25
+ @_hash['evse_id'] = 'EvseId'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(ev_charge_number = nil,
40
+ evse_id = nil)
41
+ @ev_charge_number = ev_charge_number
42
+ @evse_id = evse_id
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ ev_charge_number =
51
+ hash.key?('EvChargeNumber') ? hash['EvChargeNumber'] : nil
52
+ evse_id = hash.key?('EvseId') ? hash['EvseId'] : nil
53
+
54
+ # Create object from extracted values.
55
+ ChargesessionStartBody.new(ev_charge_number,
56
+ evse_id)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,134 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://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 ConnectorVO < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Internal identifier used to refer to this Connector
14
+ # @return [Integer]
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 [ElectricalProperties]
28
+ attr_accessor :electrical_properties
29
+
30
+ # Indicates whether Connector has a fixed cable attached. False by default
31
+ # (not sent in this case)
32
+ # @return [TrueClass | FalseClass]
33
+ attr_accessor :fixed_cable
34
+
35
+ # Tariff details for charging on this Connector
36
+ # @return [TariffVO]
37
+ attr_accessor :tariff
38
+
39
+ # ISO8601-compliant UTC datetime of the last update of the Connectors's data
40
+ # @return [String]
41
+ attr_accessor :updated
42
+
43
+ # Source of the last update
44
+ # @return [ConnectorVOUpdatedByEnum]
45
+ attr_accessor :updated_by
46
+
47
+ # optional ISO8601-compliant UTC deletion timestamp of the connector
48
+ # @return [String]
49
+ attr_accessor :deleted
50
+
51
+ # A mapping from model property names to API property names.
52
+ def self.names
53
+ @_hash = {} if @_hash.nil?
54
+ @_hash['uid'] = 'uid'
55
+ @_hash['external_id'] = 'externalId'
56
+ @_hash['connector_type'] = 'connectorType'
57
+ @_hash['electrical_properties'] = 'electricalProperties'
58
+ @_hash['fixed_cable'] = 'fixedCable'
59
+ @_hash['tariff'] = 'tariff'
60
+ @_hash['updated'] = 'updated'
61
+ @_hash['updated_by'] = 'updatedBy'
62
+ @_hash['deleted'] = 'deleted'
63
+ @_hash
64
+ end
65
+
66
+ # An array for optional fields
67
+ def self.optionals
68
+ %w[
69
+ uid
70
+ external_id
71
+ connector_type
72
+ electrical_properties
73
+ fixed_cable
74
+ tariff
75
+ updated
76
+ updated_by
77
+ deleted
78
+ ]
79
+ end
80
+
81
+ # An array for nullable fields
82
+ def self.nullables
83
+ []
84
+ end
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,
94
+ deleted = SKIP)
95
+ @uid = uid unless uid == SKIP
96
+ @external_id = external_id unless external_id == SKIP
97
+ @connector_type = connector_type unless connector_type == SKIP
98
+ @electrical_properties = electrical_properties unless electrical_properties == SKIP
99
+ @fixed_cable = fixed_cable unless fixed_cable == SKIP
100
+ @tariff = tariff unless tariff == SKIP
101
+ @updated = updated unless updated == SKIP
102
+ @updated_by = updated_by unless updated_by == SKIP
103
+ @deleted = deleted unless deleted == SKIP
104
+ end
105
+
106
+ # Creates an instance of the object from a hash.
107
+ def self.from_hash(hash)
108
+ return nil unless hash
109
+
110
+ # Extract variables from the hash.
111
+ uid = hash.key?('uid') ? hash['uid'] : SKIP
112
+ external_id = hash.key?('externalId') ? hash['externalId'] : SKIP
113
+ connector_type = hash.key?('connectorType') ? hash['connectorType'] : SKIP
114
+ electrical_properties = ElectricalProperties.from_hash(hash['electricalProperties']) if
115
+ hash['electricalProperties']
116
+ fixed_cable = hash.key?('fixedCable') ? hash['fixedCable'] : SKIP
117
+ tariff = TariffVO.from_hash(hash['tariff']) if hash['tariff']
118
+ updated = hash.key?('updated') ? hash['updated'] : SKIP
119
+ updated_by = hash.key?('updatedBy') ? hash['updatedBy'] : SKIP
120
+ deleted = hash.key?('deleted') ? hash['deleted'] : SKIP
121
+
122
+ # Create object from extracted values.
123
+ ConnectorVO.new(uid,
124
+ external_id,
125
+ connector_type,
126
+ electrical_properties,
127
+ fixed_cable,
128
+ tariff,
129
+ updated,
130
+ updated_by,
131
+ deleted)
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,71 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # Type of the connector in the EVSE unit.
8
+ class ConnectorVOConnectorTypeEnum
9
+ CONNECTOR_VO_CONNECTOR_TYPE_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_VO_CONNECTOR_TYPE_ENUM.include?(value)
69
+ end
70
+ end
71
+ 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
+ # Source of the last update
8
+ class ConnectorVOUpdatedByEnum
9
+ CONNECTOR_VO_UPDATED_BY_ENUM = [
10
+ # TODO: Write general description for FEED
11
+ FEED = 'Feed'.freeze,
12
+
13
+ # TODO: Write general description for ADMIN
14
+ ADMIN = 'Admin'.freeze,
15
+
16
+ # TODO: Write general description for TARIFFSERVICE
17
+ TARIFFSERVICE = 'TariffService'.freeze,
18
+
19
+ # TODO: Write general description for DEFAULTS
20
+ DEFAULTS = 'Defaults'.freeze
21
+ ].freeze
22
+
23
+ def self.validate(value)
24
+ return false if value.nil?
25
+
26
+ CONNECTOR_VO_UPDATED_BY_ENUM.include?(value)
27
+ end
28
+ end
29
+ 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
+ # Coordinates of the Shell Recharge Site Location
8
+ class Coordinates < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Latitude of the Coordinate
13
+ # @return [Float]
14
+ attr_accessor :latitude
15
+
16
+ # Longitude of the Coordinate
17
+ # @return [Float]
18
+ attr_accessor :longitude
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['latitude'] = 'latitude'
24
+ @_hash['longitude'] = 'longitude'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ latitude
32
+ longitude
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(latitude = SKIP,
42
+ longitude = SKIP)
43
+ @latitude = latitude unless latitude == SKIP
44
+ @longitude = longitude unless longitude == 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
+ latitude = hash.key?('latitude') ? hash['latitude'] : SKIP
53
+ longitude = hash.key?('longitude') ? hash['longitude'] : SKIP
54
+
55
+ # Create object from extracted values.
56
+ Coordinates.new(latitude,
57
+ longitude)
58
+ end
59
+
60
+ # Validates an instance of the object from a given value.
61
+ # @param [Coordinates | Hash] The value against the validation is performed.
62
+ def self.validate(value)
63
+ return true if value.instance_of? self
64
+
65
+ return false unless value.instance_of? Hash
66
+
67
+ true
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,153 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module ShellEv
8
+ # DataActive Model.
9
+ class DataActive < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Id of the session
14
+ # @return [UUID | String]
15
+ attr_accessor :id
16
+
17
+ # Id of the user that started the session
18
+ # @return [String]
19
+ attr_accessor :user_id
20
+
21
+ # Id of the evse that the user is charging
22
+ # @return [String]
23
+ attr_accessor :ema_id
24
+
25
+ # Electric Vehicle Supply Equipment Identifier. An EVSEID identifies a
26
+ # Charging Point.
27
+ # @return [String]
28
+ attr_accessor :evse_id
29
+
30
+ # When the session is started
31
+ # @return [DateTime]
32
+ attr_accessor :started_at
33
+
34
+ # When the session is stopped
35
+ # @return [DateTime]
36
+ attr_accessor :stopped_at
37
+
38
+ # Describes the session state
39
+ # @return [DataActiveSessionStateEnum]
40
+ attr_accessor :session_state
41
+
42
+ # Session code e.g InternalError
43
+ # @return [DataActiveSessionCodeEnum]
44
+ attr_accessor :session_code
45
+
46
+ # Session message
47
+ # @return [String]
48
+ attr_accessor :session_message
49
+
50
+ # A mapping from model property names to API property names.
51
+ def self.names
52
+ @_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'
59
+ @_hash['session_state'] = 'SessionState'
60
+ @_hash['session_code'] = 'SessionCode'
61
+ @_hash['session_message'] = 'SessionMessage'
62
+ @_hash
63
+ end
64
+
65
+ # An array for optional fields
66
+ def self.optionals
67
+ %w[
68
+ id
69
+ user_id
70
+ ema_id
71
+ evse_id
72
+ started_at
73
+ stopped_at
74
+ session_state
75
+ session_code
76
+ session_message
77
+ ]
78
+ end
79
+
80
+ # An array for nullable fields
81
+ def self.nullables
82
+ %w[
83
+ stopped_at
84
+ session_code
85
+ session_message
86
+ ]
87
+ end
88
+
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)
98
+ @id = id unless id == SKIP
99
+ @user_id = user_id unless user_id == SKIP
100
+ @ema_id = ema_id unless ema_id == SKIP
101
+ @evse_id = evse_id unless evse_id == SKIP
102
+ @started_at = started_at unless started_at == SKIP
103
+ @stopped_at = stopped_at unless stopped_at == SKIP
104
+ @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
107
+ end
108
+
109
+ # Creates an instance of the object from a hash.
110
+ def self.from_hash(hash)
111
+ return nil unless hash
112
+
113
+ # 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'])
120
+ else
121
+ SKIP
122
+ end
123
+ stopped_at = if hash.key?('StoppedAt')
124
+ (DateTimeHelper.from_rfc3339(hash['StoppedAt']) if hash['StoppedAt'])
125
+ else
126
+ SKIP
127
+ 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
132
+
133
+ # Create object from extracted values.
134
+ DataActive.new(id,
135
+ user_id,
136
+ ema_id,
137
+ evse_id,
138
+ started_at,
139
+ stopped_at,
140
+ session_state,
141
+ session_code,
142
+ session_message)
143
+ end
144
+
145
+ def to_custom_started_at
146
+ DateTimeHelper.to_rfc3339(started_at)
147
+ end
148
+
149
+ def to_custom_stopped_at
150
+ DateTimeHelper.to_rfc3339(stopped_at)
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,44 @@
1
+ # shell_ev
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellEv
7
+ # Session code e.g InternalError
8
+ class DataActiveSessionCodeEnum
9
+ DATA_ACTIVE_SESSION_CODE_ENUM = [
10
+ # TODO: Write general description for INTERNALERROR
11
+ INTERNALERROR = 'InternalError'.freeze,
12
+
13
+ # TODO: Write general description for SERVICEUNAVAILABLE
14
+ SERVICEUNAVAILABLE = 'ServiceUnavailable'.freeze,
15
+
16
+ # TODO: Write general description for CHARGETOKENNOTSUPPORTED
17
+ CHARGETOKENNOTSUPPORTED = 'ChargeTokenNotSupported'.freeze,
18
+
19
+ # TODO: Write general description for SESSIONINVALID
20
+ SESSIONINVALID = 'SessionInvalid'.freeze,
21
+
22
+ # TODO: Write general description for EVNOTCONNECTEDTOEVSE
23
+ EVNOTCONNECTEDTOEVSE = 'EvNotConnectedToEvse'.freeze,
24
+
25
+ # TODO: Write general description for EVSEINUSE
26
+ EVSEINUSE = 'EvseInUse'.freeze,
27
+
28
+ # TODO: Write general description for EVSEOUTOFSERVICE
29
+ EVSEOUTOFSERVICE = 'EvseOutOfService'.freeze,
30
+
31
+ # TODO: Write general description for EVSENOTFOUND
32
+ EVSENOTFOUND = 'EvseNotFound'.freeze,
33
+
34
+ # TODO: Write general description for EVSENOTSUPPORTED
35
+ EVSENOTSUPPORTED = 'EvseNotSupported'.freeze
36
+ ].freeze
37
+
38
+ def self.validate(value)
39
+ return false if value.nil?
40
+
41
+ DATA_ACTIVE_SESSION_CODE_ENUM.include?(value)
42
+ end
43
+ end
44
+ end