ev-recharge-sdk 1.3.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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +91 -25
- data/bin/console +15 -0
- data/lib/shell_ev/api_helper.rb +2 -2
- data/lib/shell_ev/client.rb +15 -4
- data/lib/shell_ev/configuration.rb +88 -15
- data/lib/shell_ev/controllers/base_controller.rb +3 -9
- data/lib/shell_ev/controllers/charging_controller.rb +19 -18
- data/lib/shell_ev/controllers/locations_controller.rb +48 -50
- data/lib/shell_ev/controllers/o_auth_authorization_controller.rb +5 -5
- data/lib/shell_ev/exceptions/api_exception.rb +13 -2
- data/lib/shell_ev/exceptions/bad_request_exception.rb +20 -5
- data/lib/shell_ev/exceptions/internal_server_error_exception.rb +21 -5
- data/lib/shell_ev/exceptions/not_found_exception.rb +20 -5
- data/lib/shell_ev/exceptions/o_auth_provider_exception.rb +21 -5
- data/lib/shell_ev/exceptions/serviceunavailable_exception.rb +20 -5
- data/lib/shell_ev/exceptions/too_many_requests_exception.rb +20 -5
- data/lib/shell_ev/exceptions/unauthorized_exception.rb +20 -5
- data/lib/shell_ev/exceptions/v2_charge_session_retrieve404_error_exception.rb +67 -0
- data/lib/shell_ev/exceptions/v2_charge_session_start404_error_exception.rb +67 -0
- data/lib/shell_ev/exceptions/v2_charge_session_stop404_error_exception.rb +67 -0
- data/lib/shell_ev/http/auth/o_auth2.rb +18 -3
- data/lib/shell_ev/http/http_call_back.rb +2 -2
- data/lib/shell_ev/http/http_method_enum.rb +2 -2
- data/lib/shell_ev/http/http_request.rb +2 -2
- data/lib/shell_ev/http/http_response.rb +2 -2
- data/lib/shell_ev/http/proxy_settings.rb +22 -0
- data/lib/shell_ev/models/accessibility_status_enum.rb +17 -2
- data/lib/shell_ev/models/{accessibility.rb → accessibility_v2.rb} +17 -14
- data/lib/shell_ev/models/active_response200_json.rb +15 -2
- data/lib/shell_ev/models/active_response200_json_status_enum.rb +15 -2
- data/lib/shell_ev/models/address.rb +16 -2
- data/lib/shell_ev/models/bad_request_err_msg.rb +16 -2
- data/lib/shell_ev/models/base_model.rb +2 -2
- data/lib/shell_ev/models/charge_error.rb +14 -2
- data/lib/shell_ev/models/charge_retrieve_state.rb +14 -2
- data/lib/shell_ev/models/chargesession_start_body.rb +15 -2
- data/lib/shell_ev/models/connector_types_enum.rb +100 -0
- data/lib/shell_ev/models/connector_v2.rb +95 -0
- data/lib/shell_ev/models/connector_vo_connector_type_enum.rb +31 -2
- data/lib/shell_ev/models/connector_vo_updated_by_enum.rb +17 -2
- data/lib/shell_ev/models/coordinates.rb +14 -2
- data/lib/shell_ev/models/coordinates1.rb +81 -0
- data/lib/shell_ev/models/data_active.rb +19 -2
- data/lib/shell_ev/models/data_retrieve.rb +19 -2
- data/lib/shell_ev/models/day_of_week_enum.rb +56 -0
- data/lib/shell_ev/models/electrical_properties_power_type_enum.rb +16 -2
- data/lib/shell_ev/models/{electrical_properties.rb → electrical_properties_v2.rb} +22 -8
- data/lib/shell_ev/models/evse_status_enum.rb +44 -0
- data/lib/shell_ev/models/{evse_vo.rb → evse_v2.rb} +45 -38
- data/lib/shell_ev/models/evse_vo_authorization_methods_enum.rb +16 -2
- data/lib/shell_ev/models/evse_vo_status_enum.rb +17 -2
- data/lib/shell_ev/models/get_charge_session_retrieve_response200_json.rb +15 -2
- data/lib/shell_ev/models/get_charge_session_retrieve_response200_json_status_enum.rb +15 -2
- data/lib/shell_ev/models/get_ev_locations_authorization_methods_enum.rb +16 -2
- data/lib/shell_ev/models/get_ev_locations_connector_types_enum.rb +31 -2
- data/lib/shell_ev/models/get_ev_locations_evse_status_enum.rb +17 -2
- data/lib/shell_ev/models/inline_response202.rb +17 -6
- data/lib/shell_ev/models/inline_response2021.rb +14 -2
- data/lib/shell_ev/models/inline_response2021_status_enum.rb +15 -2
- data/lib/shell_ev/models/inline_response202_data.rb +14 -2
- data/lib/shell_ev/models/inline_response202_status_enum.rb +15 -2
- data/lib/shell_ev/models/internal_error_object.rb +15 -2
- data/lib/shell_ev/models/{location_respone_object.rb → location_respone_object_v2.rb} +61 -30
- data/lib/shell_ev/models/locations_markers_authorization_methods_enum.rb +16 -2
- data/lib/shell_ev/models/locations_markers_connector_types_enum.rb +31 -2
- data/lib/shell_ev/models/locations_markers_evse_status_enum.rb +17 -2
- data/lib/shell_ev/models/multi_location_marker.rb +22 -5
- data/lib/shell_ev/models/multi_location_marker_v2.rb +126 -0
- data/lib/shell_ev/models/nearby_locations_authorization_methods_enum.rb +16 -2
- data/lib/shell_ev/models/nearby_locations_connector_types_enum.rb +31 -2
- data/lib/shell_ev/models/nearby_locations_evse_status_enum.rb +17 -2
- data/lib/shell_ev/models/not_found_err_msg.rb +16 -2
- data/lib/shell_ev/models/o_auth_provider_error_enum.rb +19 -2
- data/lib/shell_ev/models/o_auth_token.rb +2 -2
- data/lib/shell_ev/models/opening_hours_object.rb +17 -3
- data/lib/shell_ev/models/opening_hours_object_week_day_enum.rb +20 -2
- data/lib/shell_ev/models/power_range.rb +68 -0
- data/lib/shell_ev/models/price_component.rb +86 -0
- data/lib/shell_ev/models/ratelimit_err_msg.rb +16 -2
- data/lib/shell_ev/models/{response.rb → response_v2.rb} +22 -9
- data/lib/shell_ev/models/restrictions.rb +183 -0
- data/lib/shell_ev/models/search_by_id_connector.rb +115 -0
- data/lib/shell_ev/models/search_by_id_evse.rb +145 -0
- data/lib/shell_ev/models/search_by_id_location_respone.rb +196 -0
- data/lib/shell_ev/models/search_by_id_response.rb +91 -0
- data/lib/shell_ev/models/serviceunavailable_err_msg.rb +16 -2
- data/lib/shell_ev/models/single_location_marker.rb +27 -6
- data/lib/shell_ev/models/single_location_marker_authorization_methods_items_enum.rb +16 -2
- data/lib/shell_ev/models/single_location_marker_response.rb +15 -2
- data/lib/shell_ev/models/single_location_marker_response_v2.rb +94 -0
- data/lib/shell_ev/models/single_location_marker_status_enum.rb +17 -2
- data/lib/shell_ev/models/single_location_marker_v2.rb +157 -0
- data/lib/shell_ev/models/tariff.rb +20 -3
- data/lib/shell_ev/models/tariff_alt_text.rb +68 -0
- data/lib/shell_ev/models/tariff_element.rb +80 -0
- data/lib/shell_ev/models/tariff_type_enum.rb +44 -0
- data/lib/shell_ev/models/tariff_v2.rb +226 -0
- data/lib/shell_ev/models/tariff_vo_updated_by_enum.rb +17 -2
- data/lib/shell_ev/models/type_enum.rb +44 -0
- data/lib/shell_ev/models/unauthorized_err_msg.rb +16 -2
- data/lib/shell_ev/utilities/date_time_helper.rb +2 -2
- data/lib/shell_ev/utilities/file_wrapper.rb +16 -4
- data/lib/shell_ev/utilities/union_type_lookup.rb +19 -2
- data/lib/shell_ev.rb +34 -10
- data/test/controllers/controller_test_base.rb +5 -10
- data/test/controllers/test_charging_controller.rb +7 -11
- data/test/controllers/test_locations_controller.rb +8 -11
- data/test/http_response_catcher.rb +3 -3
- metadata +38 -15
- data/lib/shell_ev/models/connector_vo.rb +0 -131
- data/lib/shell_ev/models/tariff_vo.rb +0 -107
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# shell_ev
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
5
|
|
|
6
6
|
module ShellEv
|
|
7
7
|
# Minimum of all status values in the Marker, e.g. if at least one Evse in the
|
|
@@ -26,5 +26,20 @@ module ShellEv
|
|
|
26
26
|
|
|
27
27
|
SINGLE_LOCATION_MARKER_STATUS_ENUM.include?(value)
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
def self.from_value(value, default_value = AVAILABLE)
|
|
31
|
+
return default_value if value.nil?
|
|
32
|
+
|
|
33
|
+
str = value.to_s.strip
|
|
34
|
+
|
|
35
|
+
case str.downcase
|
|
36
|
+
when 'available' then AVAILABLE
|
|
37
|
+
when 'occupied' then OCCUPIED
|
|
38
|
+
when 'unavailable' then UNAVAILABLE
|
|
39
|
+
when 'unknown' then UNKNOWN
|
|
40
|
+
else
|
|
41
|
+
default_value
|
|
42
|
+
end
|
|
43
|
+
end
|
|
29
44
|
end
|
|
30
45
|
end
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# shell_ev
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ShellEv
|
|
7
|
+
# A Marker is a place on the map that represent a single Location
|
|
8
|
+
class SingleLocationMarkerV2 < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Minimum of all status values in the Marker, e.g. if at least one Evse in
|
|
13
|
+
# the Marker is available, the value will be available
|
|
14
|
+
# @return [SingleLocationMarkerStatusEnum]
|
|
15
|
+
attr_accessor :status
|
|
16
|
+
|
|
17
|
+
# Coordinates of the Shell Recharge Site Location
|
|
18
|
+
# @return [Coordinates]
|
|
19
|
+
attr_accessor :coordinates
|
|
20
|
+
|
|
21
|
+
# Total number of Evse units in Locations that this Marker represents
|
|
22
|
+
# @return [Float]
|
|
23
|
+
attr_accessor :evse_count
|
|
24
|
+
|
|
25
|
+
# Maximum power in kW across all locations grouped in this marker
|
|
26
|
+
# (disregarding availability)
|
|
27
|
+
# @return [Float]
|
|
28
|
+
attr_accessor :max_power
|
|
29
|
+
|
|
30
|
+
# Number of Locations that this Marker represents in the given set of bounds
|
|
31
|
+
# @return [Float]
|
|
32
|
+
attr_accessor :location_count
|
|
33
|
+
|
|
34
|
+
# Unique ID of the Location this Marker represents
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :location_uid
|
|
37
|
+
|
|
38
|
+
# Methods that can be used to Authorize sessions on this EVSE
|
|
39
|
+
# @return [Array[SingleLocationMarkerAuthorizationMethodsItemsEnum]]
|
|
40
|
+
attr_accessor :authorization_methods
|
|
41
|
+
|
|
42
|
+
# Operator of this Shell Recharge Location
|
|
43
|
+
# @return [String]
|
|
44
|
+
attr_accessor :operator_name
|
|
45
|
+
|
|
46
|
+
# Type of the Marker, in this case it will always be SingleLocation
|
|
47
|
+
# @return [String]
|
|
48
|
+
attr_reader :marker_type
|
|
49
|
+
|
|
50
|
+
# A mapping from model property names to API property names.
|
|
51
|
+
def self.names
|
|
52
|
+
@_hash = {} if @_hash.nil?
|
|
53
|
+
@_hash['status'] = 'status'
|
|
54
|
+
@_hash['coordinates'] = 'coordinates'
|
|
55
|
+
@_hash['evse_count'] = 'evseCount'
|
|
56
|
+
@_hash['max_power'] = 'maxPower'
|
|
57
|
+
@_hash['location_count'] = 'locationCount'
|
|
58
|
+
@_hash['location_uid'] = 'locationUid'
|
|
59
|
+
@_hash['authorization_methods'] = 'authorizationMethods'
|
|
60
|
+
@_hash['operator_name'] = 'operatorName'
|
|
61
|
+
@_hash['marker_type'] = 'markerType'
|
|
62
|
+
@_hash
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# An array for optional fields
|
|
66
|
+
def self.optionals
|
|
67
|
+
%w[
|
|
68
|
+
status
|
|
69
|
+
coordinates
|
|
70
|
+
evse_count
|
|
71
|
+
max_power
|
|
72
|
+
location_count
|
|
73
|
+
location_uid
|
|
74
|
+
authorization_methods
|
|
75
|
+
operator_name
|
|
76
|
+
]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# An array for nullable fields
|
|
80
|
+
def self.nullables
|
|
81
|
+
[]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def initialize(status = SKIP, coordinates = SKIP, evse_count = SKIP,
|
|
85
|
+
max_power = SKIP, location_count = SKIP, location_uid = SKIP,
|
|
86
|
+
authorization_methods = SKIP, operator_name = SKIP)
|
|
87
|
+
@status = status unless status == SKIP
|
|
88
|
+
@coordinates = coordinates unless coordinates == SKIP
|
|
89
|
+
@evse_count = evse_count unless evse_count == SKIP
|
|
90
|
+
@max_power = max_power unless max_power == SKIP
|
|
91
|
+
@location_count = location_count unless location_count == SKIP
|
|
92
|
+
@location_uid = location_uid unless location_uid == SKIP
|
|
93
|
+
@authorization_methods = authorization_methods unless authorization_methods == SKIP
|
|
94
|
+
@operator_name = operator_name unless operator_name == SKIP
|
|
95
|
+
@marker_type = 'SingleLocation'
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Creates an instance of the object from a hash.
|
|
99
|
+
def self.from_hash(hash)
|
|
100
|
+
return nil unless hash
|
|
101
|
+
|
|
102
|
+
# Extract variables from the hash.
|
|
103
|
+
status = hash.key?('status') ? hash['status'] : SKIP
|
|
104
|
+
coordinates = Coordinates.from_hash(hash['coordinates']) if hash['coordinates']
|
|
105
|
+
evse_count = hash.key?('evseCount') ? hash['evseCount'] : SKIP
|
|
106
|
+
max_power = hash.key?('maxPower') ? hash['maxPower'] : SKIP
|
|
107
|
+
location_count = hash.key?('locationCount') ? hash['locationCount'] : SKIP
|
|
108
|
+
location_uid = hash.key?('locationUid') ? hash['locationUid'] : SKIP
|
|
109
|
+
authorization_methods =
|
|
110
|
+
hash.key?('authorizationMethods') ? hash['authorizationMethods'] : SKIP
|
|
111
|
+
operator_name = hash.key?('operatorName') ? hash['operatorName'] : SKIP
|
|
112
|
+
|
|
113
|
+
# Create object from extracted values.
|
|
114
|
+
SingleLocationMarkerV2.new(status,
|
|
115
|
+
coordinates,
|
|
116
|
+
evse_count,
|
|
117
|
+
max_power,
|
|
118
|
+
location_count,
|
|
119
|
+
location_uid,
|
|
120
|
+
authorization_methods,
|
|
121
|
+
operator_name)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Validates an instance of the object from a given value.
|
|
125
|
+
# @param [SingleLocationMarkerV2 | Hash] The value against the validation is performed.
|
|
126
|
+
def self.validate(value)
|
|
127
|
+
if value.instance_of? self
|
|
128
|
+
return APIHelper.valid_type?(value.marker_type,
|
|
129
|
+
->(val) { val.instance_of? String })
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
return false unless value.instance_of? Hash
|
|
133
|
+
|
|
134
|
+
APIHelper.valid_type?(value['markerType'],
|
|
135
|
+
->(val) { val.instance_of? String })
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Provides a human-readable string representation of the object.
|
|
139
|
+
def to_s
|
|
140
|
+
class_name = self.class.name.split('::').last
|
|
141
|
+
"<#{class_name} status: #{@status}, coordinates: #{@coordinates}, evse_count:"\
|
|
142
|
+
" #{@evse_count}, max_power: #{@max_power}, location_count: #{@location_count},"\
|
|
143
|
+
" location_uid: #{@location_uid}, authorization_methods: #{@authorization_methods},"\
|
|
144
|
+
" operator_name: #{@operator_name}, marker_type: #{@marker_type}>"
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
148
|
+
def inspect
|
|
149
|
+
class_name = self.class.name.split('::').last
|
|
150
|
+
"<#{class_name} status: #{@status.inspect}, coordinates: #{@coordinates.inspect},"\
|
|
151
|
+
" evse_count: #{@evse_count.inspect}, max_power: #{@max_power.inspect}, location_count:"\
|
|
152
|
+
" #{@location_count.inspect}, location_uid: #{@location_uid.inspect}, authorization_methods:"\
|
|
153
|
+
" #{@authorization_methods.inspect}, operator_name: #{@operator_name.inspect}, marker_type:"\
|
|
154
|
+
" #{@marker_type.inspect}>"
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# shell_ev
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
5
|
|
|
6
6
|
module ShellEv
|
|
7
7
|
# Tariff Model.
|
|
@@ -29,7 +29,7 @@ module ShellEv
|
|
|
29
29
|
# @return [String]
|
|
30
30
|
attr_accessor :updated
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# Source of the last update of the tariff details
|
|
33
33
|
# @return [TariffVOUpdatedByEnum]
|
|
34
34
|
attr_accessor :updated_by
|
|
35
35
|
|
|
@@ -103,5 +103,22 @@ module ShellEv
|
|
|
103
103
|
updated_by,
|
|
104
104
|
structure)
|
|
105
105
|
end
|
|
106
|
+
|
|
107
|
+
# Provides a human-readable string representation of the object.
|
|
108
|
+
def to_s
|
|
109
|
+
class_name = self.class.name.split('::').last
|
|
110
|
+
"<#{class_name} start_fee: #{@start_fee}, per_minute: #{@per_minute}, per_k_wh:"\
|
|
111
|
+
" #{@per_k_wh}, currency: #{@currency}, updated: #{@updated}, updated_by: #{@updated_by},"\
|
|
112
|
+
" structure: #{@structure}>"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
116
|
+
def inspect
|
|
117
|
+
class_name = self.class.name.split('::').last
|
|
118
|
+
"<#{class_name} start_fee: #{@start_fee.inspect}, per_minute: #{@per_minute.inspect},"\
|
|
119
|
+
" per_k_wh: #{@per_k_wh.inspect}, currency: #{@currency.inspect}, updated:"\
|
|
120
|
+
" #{@updated.inspect}, updated_by: #{@updated_by.inspect}, structure:"\
|
|
121
|
+
" #{@structure.inspect}>"
|
|
122
|
+
end
|
|
106
123
|
end
|
|
107
124
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# shell_ev
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ShellEv
|
|
7
|
+
# TariffAltText Model.
|
|
8
|
+
class TariffAltText < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# ISO language code
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :language
|
|
15
|
+
|
|
16
|
+
# Human readable tariff description
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :text
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['language'] = 'language'
|
|
24
|
+
@_hash['text'] = 'text'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(language = nil, text = nil)
|
|
39
|
+
@language = language
|
|
40
|
+
@text = text
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
language = hash.key?('language') ? hash['language'] : nil
|
|
49
|
+
text = hash.key?('text') ? hash['text'] : nil
|
|
50
|
+
|
|
51
|
+
# Create object from extracted values.
|
|
52
|
+
TariffAltText.new(language,
|
|
53
|
+
text)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Provides a human-readable string representation of the object.
|
|
57
|
+
def to_s
|
|
58
|
+
class_name = self.class.name.split('::').last
|
|
59
|
+
"<#{class_name} language: #{@language}, text: #{@text}>"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
63
|
+
def inspect
|
|
64
|
+
class_name = self.class.name.split('::').last
|
|
65
|
+
"<#{class_name} language: #{@language.inspect}, text: #{@text.inspect}>"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# shell_ev
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ShellEv
|
|
7
|
+
# TariffElement Model.
|
|
8
|
+
class TariffElement < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Array[PriceComponent]]
|
|
14
|
+
attr_accessor :price_components
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [Restrictions]
|
|
18
|
+
attr_accessor :restrictions
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['price_components'] = 'priceComponents'
|
|
24
|
+
@_hash['restrictions'] = 'restrictions'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
restrictions
|
|
32
|
+
]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# An array for nullable fields
|
|
36
|
+
def self.nullables
|
|
37
|
+
[]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def initialize(price_components = nil, restrictions = SKIP)
|
|
41
|
+
@price_components = price_components
|
|
42
|
+
@restrictions = restrictions unless restrictions == SKIP
|
|
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
|
+
# Parameter is an array, so we need to iterate through it
|
|
51
|
+
price_components = nil
|
|
52
|
+
unless hash['priceComponents'].nil?
|
|
53
|
+
price_components = []
|
|
54
|
+
hash['priceComponents'].each do |structure|
|
|
55
|
+
price_components << (PriceComponent.from_hash(structure) if structure)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
price_components = nil unless hash.key?('priceComponents')
|
|
60
|
+
restrictions = Restrictions.from_hash(hash['restrictions']) if hash['restrictions']
|
|
61
|
+
|
|
62
|
+
# Create object from extracted values.
|
|
63
|
+
TariffElement.new(price_components,
|
|
64
|
+
restrictions)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Provides a human-readable string representation of the object.
|
|
68
|
+
def to_s
|
|
69
|
+
class_name = self.class.name.split('::').last
|
|
70
|
+
"<#{class_name} price_components: #{@price_components}, restrictions: #{@restrictions}>"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
74
|
+
def inspect
|
|
75
|
+
class_name = self.class.name.split('::').last
|
|
76
|
+
"<#{class_name} price_components: #{@price_components.inspect}, restrictions:"\
|
|
77
|
+
" #{@restrictions.inspect}>"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# shell_ev
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ShellEv
|
|
7
|
+
# Tariff type classification
|
|
8
|
+
class TariffTypeEnum
|
|
9
|
+
TARIFF_TYPE_ENUM = [
|
|
10
|
+
# TODO: Write general description for DRIVER
|
|
11
|
+
DRIVER = 'DRIVER'.freeze,
|
|
12
|
+
|
|
13
|
+
# TODO: Write general description for ROAMING
|
|
14
|
+
ROAMING = 'ROAMING'.freeze,
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for REIMBURSEMENT
|
|
17
|
+
REIMBURSEMENT = 'REIMBURSEMENT'.freeze,
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for VMSP
|
|
20
|
+
VMSP = 'VMSP'.freeze
|
|
21
|
+
].freeze
|
|
22
|
+
|
|
23
|
+
def self.validate(value)
|
|
24
|
+
return false if value.nil?
|
|
25
|
+
|
|
26
|
+
TARIFF_TYPE_ENUM.include?(value)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.from_value(value, default_value = DRIVER)
|
|
30
|
+
return default_value if value.nil?
|
|
31
|
+
|
|
32
|
+
str = value.to_s.strip
|
|
33
|
+
|
|
34
|
+
case str.downcase
|
|
35
|
+
when 'driver' then DRIVER
|
|
36
|
+
when 'roaming' then ROAMING
|
|
37
|
+
when 'reimbursement' then REIMBURSEMENT
|
|
38
|
+
when 'vmsp' then VMSP
|
|
39
|
+
else
|
|
40
|
+
default_value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# shell_ev
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require 'date'
|
|
7
|
+
module ShellEv
|
|
8
|
+
# Tariff metadata aligned with TariffV2 GraphQL schema
|
|
9
|
+
class TariffV2 < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# Unique identifier for the tariff
|
|
14
|
+
# @return [String]
|
|
15
|
+
attr_accessor :tariff_id
|
|
16
|
+
|
|
17
|
+
# Tariff type classification
|
|
18
|
+
# @return [TariffTypeEnum]
|
|
19
|
+
attr_accessor :tariff_type
|
|
20
|
+
|
|
21
|
+
# Tariff type classification
|
|
22
|
+
# @return [PowerRange]
|
|
23
|
+
attr_accessor :power_range
|
|
24
|
+
|
|
25
|
+
# Internal identifier used by the platform
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :internal_id
|
|
28
|
+
|
|
29
|
+
# Unique identifier of the operator
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :operator_id
|
|
32
|
+
|
|
33
|
+
# Unique identifier of the provider
|
|
34
|
+
# @return [String]
|
|
35
|
+
attr_accessor :provider_id
|
|
36
|
+
|
|
37
|
+
# ISO 4217 Currency Code
|
|
38
|
+
# @return [String]
|
|
39
|
+
attr_accessor :currency
|
|
40
|
+
|
|
41
|
+
# ISO 4217 Currency Code
|
|
42
|
+
# @return [Array[TariffAltText]]
|
|
43
|
+
attr_accessor :tariff_alt_text
|
|
44
|
+
|
|
45
|
+
# ISO 4217 Currency Code
|
|
46
|
+
# @return [Float]
|
|
47
|
+
attr_accessor :min_price
|
|
48
|
+
|
|
49
|
+
# ISO 4217 Currency Code
|
|
50
|
+
# @return [Float]
|
|
51
|
+
attr_accessor :max_price
|
|
52
|
+
|
|
53
|
+
# ISO 4217 Currency Code
|
|
54
|
+
# @return [Array[TariffElement]]
|
|
55
|
+
attr_accessor :elements
|
|
56
|
+
|
|
57
|
+
# ISO 4217 Currency Code
|
|
58
|
+
# @return [DateTime]
|
|
59
|
+
attr_accessor :start_date_time
|
|
60
|
+
|
|
61
|
+
# ISO 4217 Currency Code
|
|
62
|
+
# @return [DateTime]
|
|
63
|
+
attr_accessor :end_date_time
|
|
64
|
+
|
|
65
|
+
# ISO 4217 Currency Code
|
|
66
|
+
# @return [DateTime]
|
|
67
|
+
attr_accessor :last_updated
|
|
68
|
+
|
|
69
|
+
# Identifier of the actor who created the tariff
|
|
70
|
+
# @return [String]
|
|
71
|
+
attr_accessor :created_by
|
|
72
|
+
|
|
73
|
+
# A mapping from model property names to API property names.
|
|
74
|
+
def self.names
|
|
75
|
+
@_hash = {} if @_hash.nil?
|
|
76
|
+
@_hash['tariff_id'] = 'tariffId'
|
|
77
|
+
@_hash['tariff_type'] = 'tariffType'
|
|
78
|
+
@_hash['power_range'] = 'powerRange'
|
|
79
|
+
@_hash['internal_id'] = 'internalId'
|
|
80
|
+
@_hash['operator_id'] = 'operatorId'
|
|
81
|
+
@_hash['provider_id'] = 'providerId'
|
|
82
|
+
@_hash['currency'] = 'currency'
|
|
83
|
+
@_hash['tariff_alt_text'] = 'tariffAltText'
|
|
84
|
+
@_hash['min_price'] = 'minPrice'
|
|
85
|
+
@_hash['max_price'] = 'maxPrice'
|
|
86
|
+
@_hash['elements'] = 'elements'
|
|
87
|
+
@_hash['start_date_time'] = 'startDateTime'
|
|
88
|
+
@_hash['end_date_time'] = 'endDateTime'
|
|
89
|
+
@_hash['last_updated'] = 'lastUpdated'
|
|
90
|
+
@_hash['created_by'] = 'createdBy'
|
|
91
|
+
@_hash
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# An array for optional fields
|
|
95
|
+
def self.optionals
|
|
96
|
+
[]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# An array for nullable fields
|
|
100
|
+
def self.nullables
|
|
101
|
+
%w[
|
|
102
|
+
tariff_alt_text
|
|
103
|
+
]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def initialize(tariff_id = nil, tariff_type = nil, power_range = nil,
|
|
107
|
+
internal_id = nil, operator_id = nil, provider_id = nil,
|
|
108
|
+
currency = nil, tariff_alt_text = nil, min_price = nil,
|
|
109
|
+
max_price = nil, elements = nil, start_date_time = nil,
|
|
110
|
+
end_date_time = nil, last_updated = nil, created_by = nil)
|
|
111
|
+
@tariff_id = tariff_id
|
|
112
|
+
@tariff_type = tariff_type
|
|
113
|
+
@power_range = power_range
|
|
114
|
+
@internal_id = internal_id
|
|
115
|
+
@operator_id = operator_id
|
|
116
|
+
@provider_id = provider_id
|
|
117
|
+
@currency = currency
|
|
118
|
+
@tariff_alt_text = tariff_alt_text
|
|
119
|
+
@min_price = min_price
|
|
120
|
+
@max_price = max_price
|
|
121
|
+
@elements = elements
|
|
122
|
+
@start_date_time = start_date_time
|
|
123
|
+
@end_date_time = end_date_time
|
|
124
|
+
@last_updated = last_updated
|
|
125
|
+
@created_by = created_by
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Creates an instance of the object from a hash.
|
|
129
|
+
def self.from_hash(hash)
|
|
130
|
+
return nil unless hash
|
|
131
|
+
|
|
132
|
+
# Extract variables from the hash.
|
|
133
|
+
tariff_id = hash.key?('tariffId') ? hash['tariffId'] : nil
|
|
134
|
+
tariff_type = hash.key?('tariffType') ? hash['tariffType'] : nil
|
|
135
|
+
power_range = PowerRange.from_hash(hash['powerRange']) if hash['powerRange']
|
|
136
|
+
internal_id = hash.key?('internalId') ? hash['internalId'] : nil
|
|
137
|
+
operator_id = hash.key?('operatorId') ? hash['operatorId'] : nil
|
|
138
|
+
provider_id = hash.key?('providerId') ? hash['providerId'] : nil
|
|
139
|
+
currency = hash.key?('currency') ? hash['currency'] : nil
|
|
140
|
+
# Parameter is an array, so we need to iterate through it
|
|
141
|
+
tariff_alt_text = nil
|
|
142
|
+
unless hash['tariffAltText'].nil?
|
|
143
|
+
tariff_alt_text = []
|
|
144
|
+
hash['tariffAltText'].each do |structure|
|
|
145
|
+
tariff_alt_text << (TariffAltText.from_hash(structure) if structure)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
tariff_alt_text = nil unless hash.key?('tariffAltText')
|
|
150
|
+
min_price = hash.key?('minPrice') ? hash['minPrice'] : nil
|
|
151
|
+
max_price = hash.key?('maxPrice') ? hash['maxPrice'] : nil
|
|
152
|
+
# Parameter is an array, so we need to iterate through it
|
|
153
|
+
elements = nil
|
|
154
|
+
unless hash['elements'].nil?
|
|
155
|
+
elements = []
|
|
156
|
+
hash['elements'].each do |structure|
|
|
157
|
+
elements << (TariffElement.from_hash(structure) if structure)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
elements = nil unless hash.key?('elements')
|
|
162
|
+
start_date_time = if hash.key?('startDateTime')
|
|
163
|
+
(DateTimeHelper.from_rfc3339(hash['startDateTime']) if hash['startDateTime'])
|
|
164
|
+
end
|
|
165
|
+
end_date_time = if hash.key?('endDateTime')
|
|
166
|
+
(DateTimeHelper.from_rfc3339(hash['endDateTime']) if hash['endDateTime'])
|
|
167
|
+
end
|
|
168
|
+
last_updated = if hash.key?('lastUpdated')
|
|
169
|
+
(DateTimeHelper.from_rfc3339(hash['lastUpdated']) if hash['lastUpdated'])
|
|
170
|
+
end
|
|
171
|
+
created_by = hash.key?('createdBy') ? hash['createdBy'] : nil
|
|
172
|
+
|
|
173
|
+
# Create object from extracted values.
|
|
174
|
+
TariffV2.new(tariff_id,
|
|
175
|
+
tariff_type,
|
|
176
|
+
power_range,
|
|
177
|
+
internal_id,
|
|
178
|
+
operator_id,
|
|
179
|
+
provider_id,
|
|
180
|
+
currency,
|
|
181
|
+
tariff_alt_text,
|
|
182
|
+
min_price,
|
|
183
|
+
max_price,
|
|
184
|
+
elements,
|
|
185
|
+
start_date_time,
|
|
186
|
+
end_date_time,
|
|
187
|
+
last_updated,
|
|
188
|
+
created_by)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def to_custom_start_date_time
|
|
192
|
+
DateTimeHelper.to_rfc3339(start_date_time)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def to_custom_end_date_time
|
|
196
|
+
DateTimeHelper.to_rfc3339(end_date_time)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def to_custom_last_updated
|
|
200
|
+
DateTimeHelper.to_rfc3339(last_updated)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Provides a human-readable string representation of the object.
|
|
204
|
+
def to_s
|
|
205
|
+
class_name = self.class.name.split('::').last
|
|
206
|
+
"<#{class_name} tariff_id: #{@tariff_id}, tariff_type: #{@tariff_type}, power_range:"\
|
|
207
|
+
" #{@power_range}, internal_id: #{@internal_id}, operator_id: #{@operator_id}, provider_id:"\
|
|
208
|
+
" #{@provider_id}, currency: #{@currency}, tariff_alt_text: #{@tariff_alt_text}, min_price:"\
|
|
209
|
+
" #{@min_price}, max_price: #{@max_price}, elements: #{@elements}, start_date_time:"\
|
|
210
|
+
" #{@start_date_time}, end_date_time: #{@end_date_time}, last_updated: #{@last_updated},"\
|
|
211
|
+
" created_by: #{@created_by}>"
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
215
|
+
def inspect
|
|
216
|
+
class_name = self.class.name.split('::').last
|
|
217
|
+
"<#{class_name} tariff_id: #{@tariff_id.inspect}, tariff_type: #{@tariff_type.inspect},"\
|
|
218
|
+
" power_range: #{@power_range.inspect}, internal_id: #{@internal_id.inspect}, operator_id:"\
|
|
219
|
+
" #{@operator_id.inspect}, provider_id: #{@provider_id.inspect}, currency:"\
|
|
220
|
+
" #{@currency.inspect}, tariff_alt_text: #{@tariff_alt_text.inspect}, min_price:"\
|
|
221
|
+
" #{@min_price.inspect}, max_price: #{@max_price.inspect}, elements: #{@elements.inspect},"\
|
|
222
|
+
" start_date_time: #{@start_date_time.inspect}, end_date_time: #{@end_date_time.inspect},"\
|
|
223
|
+
" last_updated: #{@last_updated.inspect}, created_by: #{@created_by.inspect}>"
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# shell_ev
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by APIMATIC
|
|
4
|
-
#
|
|
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 of the tariff details
|
|
@@ -25,5 +25,20 @@ module ShellEv
|
|
|
25
25
|
|
|
26
26
|
TARIFF_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
|