vmsp-sdk 0.0.1

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 (130) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +167 -0
  4. data/bin/console +15 -0
  5. data/lib/e_mobility_vmspocpiap_is/api_helper.rb +10 -0
  6. data/lib/e_mobility_vmspocpiap_is/client.rb +138 -0
  7. data/lib/e_mobility_vmspocpiap_is/configuration.rb +176 -0
  8. data/lib/e_mobility_vmspocpiap_is/controllers/account_controller.rb +53 -0
  9. data/lib/e_mobility_vmspocpiap_is/controllers/base_controller.rb +60 -0
  10. data/lib/e_mobility_vmspocpiap_is/controllers/cd_rs_pull_controller.rb +103 -0
  11. data/lib/e_mobility_vmspocpiap_is/controllers/cd_rs_push_controller.rb +51 -0
  12. data/lib/e_mobility_vmspocpiap_is/controllers/commands_callback_controller.rb +56 -0
  13. data/lib/e_mobility_vmspocpiap_is/controllers/commands_controller.rb +102 -0
  14. data/lib/e_mobility_vmspocpiap_is/controllers/locations_pull_controller.rb +125 -0
  15. data/lib/e_mobility_vmspocpiap_is/controllers/locations_push_controller.rb +68 -0
  16. data/lib/e_mobility_vmspocpiap_is/controllers/sessions_pull_controller.rb +91 -0
  17. data/lib/e_mobility_vmspocpiap_is/controllers/sessions_push_controller.rb +74 -0
  18. data/lib/e_mobility_vmspocpiap_is/controllers/tariffs_pull_controller.rb +117 -0
  19. data/lib/e_mobility_vmspocpiap_is/controllers/tariffs_push_controller.rb +62 -0
  20. data/lib/e_mobility_vmspocpiap_is/exceptions/accounts_ocpi_error_response_exception.rb +69 -0
  21. data/lib/e_mobility_vmspocpiap_is/exceptions/accounts_ocpi_response_exception.rb +67 -0
  22. data/lib/e_mobility_vmspocpiap_is/exceptions/accounts_ocpi_unauthorized_response_exception.rb +64 -0
  23. data/lib/e_mobility_vmspocpiap_is/exceptions/api_exception.rb +21 -0
  24. data/lib/e_mobility_vmspocpiap_is/exceptions/ocpi_error_response_exception.rb +71 -0
  25. data/lib/e_mobility_vmspocpiap_is/exceptions/ocpi_response_error_exception.rb +67 -0
  26. data/lib/e_mobility_vmspocpiap_is/exceptions/ocpi_unauthorized_response_exception.rb +64 -0
  27. data/lib/e_mobility_vmspocpiap_is/exceptions/v3_commands_startsession400_error_exception.rb +67 -0
  28. data/lib/e_mobility_vmspocpiap_is/http/auth/bearer_authorization.rb +53 -0
  29. data/lib/e_mobility_vmspocpiap_is/http/auth/ocpi_authorization.rb +52 -0
  30. data/lib/e_mobility_vmspocpiap_is/http/http_call_back.rb +10 -0
  31. data/lib/e_mobility_vmspocpiap_is/http/http_method_enum.rb +10 -0
  32. data/lib/e_mobility_vmspocpiap_is/http/http_request.rb +10 -0
  33. data/lib/e_mobility_vmspocpiap_is/http/http_response.rb +10 -0
  34. data/lib/e_mobility_vmspocpiap_is/http/proxy_settings.rb +22 -0
  35. data/lib/e_mobility_vmspocpiap_is/models/account_details.rb +237 -0
  36. data/lib/e_mobility_vmspocpiap_is/models/account_details2.rb +237 -0
  37. data/lib/e_mobility_vmspocpiap_is/models/account_response.rb +98 -0
  38. data/lib/e_mobility_vmspocpiap_is/models/account_state_enum.rb +46 -0
  39. data/lib/e_mobility_vmspocpiap_is/models/account_state_reason_enum.rb +67 -0
  40. data/lib/e_mobility_vmspocpiap_is/models/add_on_fee.rb +101 -0
  41. data/lib/e_mobility_vmspocpiap_is/models/add_on_fee_type_enum.rb +52 -0
  42. data/lib/e_mobility_vmspocpiap_is/models/additional_geo_location.rb +82 -0
  43. data/lib/e_mobility_vmspocpiap_is/models/auth_method_enum.rb +40 -0
  44. data/lib/e_mobility_vmspocpiap_is/models/base_model.rb +110 -0
  45. data/lib/e_mobility_vmspocpiap_is/models/benefit.rb +181 -0
  46. data/lib/e_mobility_vmspocpiap_is/models/booking_restriction_type_enum.rb +44 -0
  47. data/lib/e_mobility_vmspocpiap_is/models/business_details.rb +84 -0
  48. data/lib/e_mobility_vmspocpiap_is/models/capability_enum.rb +88 -0
  49. data/lib/e_mobility_vmspocpiap_is/models/cdr.rb +462 -0
  50. data/lib/e_mobility_vmspocpiap_is/models/cdr1.rb +457 -0
  51. data/lib/e_mobility_vmspocpiap_is/models/cdr_dimension.rb +71 -0
  52. data/lib/e_mobility_vmspocpiap_is/models/cdr_dimension_type_enum.rb +97 -0
  53. data/lib/e_mobility_vmspocpiap_is/models/cdr_location.rb +206 -0
  54. data/lib/e_mobility_vmspocpiap_is/models/cdr_token.rb +91 -0
  55. data/lib/e_mobility_vmspocpiap_is/models/charge_type_enum.rb +52 -0
  56. data/lib/e_mobility_vmspocpiap_is/models/charging_period.rb +100 -0
  57. data/lib/e_mobility_vmspocpiap_is/models/command_response.rb +92 -0
  58. data/lib/e_mobility_vmspocpiap_is/models/command_response1.rb +91 -0
  59. data/lib/e_mobility_vmspocpiap_is/models/command_response_type_enum.rb +44 -0
  60. data/lib/e_mobility_vmspocpiap_is/models/command_result.rb +81 -0
  61. data/lib/e_mobility_vmspocpiap_is/models/command_result_type_enum.rb +64 -0
  62. data/lib/e_mobility_vmspocpiap_is/models/connector.rb +184 -0
  63. data/lib/e_mobility_vmspocpiap_is/models/connector_format_enum.rb +36 -0
  64. data/lib/e_mobility_vmspocpiap_is/models/connector_type_enum.rb +196 -0
  65. data/lib/e_mobility_vmspocpiap_is/models/day_of_week_enum.rb +56 -0
  66. data/lib/e_mobility_vmspocpiap_is/models/display_text.rb +68 -0
  67. data/lib/e_mobility_vmspocpiap_is/models/emaid.rb +137 -0
  68. data/lib/e_mobility_vmspocpiap_is/models/energy_mix.rb +127 -0
  69. data/lib/e_mobility_vmspocpiap_is/models/energy_source.rb +69 -0
  70. data/lib/e_mobility_vmspocpiap_is/models/energy_source_category_enum.rb +60 -0
  71. data/lib/e_mobility_vmspocpiap_is/models/environmental_impact.rb +68 -0
  72. data/lib/e_mobility_vmspocpiap_is/models/environmental_impact_category_enum.rb +36 -0
  73. data/lib/e_mobility_vmspocpiap_is/models/evse.rb +250 -0
  74. data/lib/e_mobility_vmspocpiap_is/models/exceptional_period.rb +84 -0
  75. data/lib/e_mobility_vmspocpiap_is/models/facility_enum.rb +108 -0
  76. data/lib/e_mobility_vmspocpiap_is/models/geo_location.rb +73 -0
  77. data/lib/e_mobility_vmspocpiap_is/models/hours.rb +127 -0
  78. data/lib/e_mobility_vmspocpiap_is/models/image.rb +114 -0
  79. data/lib/e_mobility_vmspocpiap_is/models/image_category_enum.rb +58 -0
  80. data/lib/e_mobility_vmspocpiap_is/models/location.rb +379 -0
  81. data/lib/e_mobility_vmspocpiap_is/models/location1.rb +375 -0
  82. data/lib/e_mobility_vmspocpiap_is/models/ocpi_command_response.rb +62 -0
  83. data/lib/e_mobility_vmspocpiap_is/models/ocpi_response.rb +98 -0
  84. data/lib/e_mobility_vmspocpiap_is/models/parking_direction_enum.rb +40 -0
  85. data/lib/e_mobility_vmspocpiap_is/models/parking_restriction_enum.rb +61 -0
  86. data/lib/e_mobility_vmspocpiap_is/models/parking_type_enum.rb +53 -0
  87. data/lib/e_mobility_vmspocpiap_is/models/power_type_enum.rb +48 -0
  88. data/lib/e_mobility_vmspocpiap_is/models/price.rb +80 -0
  89. data/lib/e_mobility_vmspocpiap_is/models/price_component.rb +99 -0
  90. data/lib/e_mobility_vmspocpiap_is/models/price_limit.rb +71 -0
  91. data/lib/e_mobility_vmspocpiap_is/models/product.rb +186 -0
  92. data/lib/e_mobility_vmspocpiap_is/models/publish_token_type.rb +106 -0
  93. data/lib/e_mobility_vmspocpiap_is/models/regular_hours.rb +80 -0
  94. data/lib/e_mobility_vmspocpiap_is/models/reservation_restriction_type_enum.rb +36 -0
  95. data/lib/e_mobility_vmspocpiap_is/models/session.rb +298 -0
  96. data/lib/e_mobility_vmspocpiap_is/models/session_status_enum.rb +60 -0
  97. data/lib/e_mobility_vmspocpiap_is/models/signed_data.rb +116 -0
  98. data/lib/e_mobility_vmspocpiap_is/models/signed_value.rb +85 -0
  99. data/lib/e_mobility_vmspocpiap_is/models/start_session.rb +107 -0
  100. data/lib/e_mobility_vmspocpiap_is/models/start_session_token.rb +68 -0
  101. data/lib/e_mobility_vmspocpiap_is/models/status2_enum.rb +44 -0
  102. data/lib/e_mobility_vmspocpiap_is/models/status_enum.rb +64 -0
  103. data/lib/e_mobility_vmspocpiap_is/models/status_schedule.rb +97 -0
  104. data/lib/e_mobility_vmspocpiap_is/models/stop_session.rb +70 -0
  105. data/lib/e_mobility_vmspocpiap_is/models/subscription_renewal_cadence_enum.rb +44 -0
  106. data/lib/e_mobility_vmspocpiap_is/models/tariff.rb +347 -0
  107. data/lib/e_mobility_vmspocpiap_is/models/tariff1.rb +336 -0
  108. data/lib/e_mobility_vmspocpiap_is/models/tariff_dimension_type_enum.rb +60 -0
  109. data/lib/e_mobility_vmspocpiap_is/models/tariff_element.rb +91 -0
  110. data/lib/e_mobility_vmspocpiap_is/models/tariff_restrictions.rb +310 -0
  111. data/lib/e_mobility_vmspocpiap_is/models/tariff_type_enum.rb +48 -0
  112. data/lib/e_mobility_vmspocpiap_is/models/tax_amount.rb +95 -0
  113. data/lib/e_mobility_vmspocpiap_is/models/tax_included_enum.rb +40 -0
  114. data/lib/e_mobility_vmspocpiap_is/models/token_type_enum.rb +48 -0
  115. data/lib/e_mobility_vmspocpiap_is/models/type_of_emaid_enum.rb +36 -0
  116. data/lib/e_mobility_vmspocpiap_is/models/url_enum.rb +36 -0
  117. data/lib/e_mobility_vmspocpiap_is/models/v3_cdrs_response.rb +107 -0
  118. data/lib/e_mobility_vmspocpiap_is/models/v3_cdrs_response1.rb +98 -0
  119. data/lib/e_mobility_vmspocpiap_is/models/v3_commands_startsession_response.rb +98 -0
  120. data/lib/e_mobility_vmspocpiap_is/models/v3_commands_stopsession_response.rb +98 -0
  121. data/lib/e_mobility_vmspocpiap_is/models/v3_locations_response.rb +107 -0
  122. data/lib/e_mobility_vmspocpiap_is/models/v3_locations_response1.rb +98 -0
  123. data/lib/e_mobility_vmspocpiap_is/models/v3_sessions_response.rb +107 -0
  124. data/lib/e_mobility_vmspocpiap_is/models/v3_tariffs_response.rb +107 -0
  125. data/lib/e_mobility_vmspocpiap_is/models/v3_tariffs_response1.rb +98 -0
  126. data/lib/e_mobility_vmspocpiap_is/models/vehicle_type_enum.rb +64 -0
  127. data/lib/e_mobility_vmspocpiap_is/utilities/date_time_helper.rb +11 -0
  128. data/lib/e_mobility_vmspocpiap_is/utilities/file_wrapper.rb +28 -0
  129. data/lib/e_mobility_vmspocpiap_is.rb +164 -0
  130. metadata +213 -0
@@ -0,0 +1,347 @@
1
+ # e_mobility_vmspocpiap_is
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module EMobilityVmspocpiapIs
8
+ # A Tariff object consists of a list of one or more Tariff Elements, which in
9
+ # turn consist of Price Components. A Tariff Element is a group of Price
10
+ # Components that apply under the same conditions. The rules for the
11
+ # conditions under which a Tariff Element applies are known as its
12
+ # "restrictions". A Price Component describes how the usage of a particular
13
+ # dimension (time, energy, etcetera) is mapped to an amount of money owed.
14
+ # When the list of Tariff Elements contains more than one Element that has a
15
+ # Price Component for a certain dimension, then the first Tariff Element with
16
+ # a Price Component for that dimension in the list with matching Tariff
17
+ # Restrictions will be used. To define a "Free of Charge" tariff in OCPI, a
18
+ # Tariff containing one Tariff Element with no restrictions containing one
19
+ # Price Component with type = FLAT and price = 0.00 has to be provided.
20
+ class Tariff < BaseModel
21
+ SKIP = Object.new
22
+ private_constant :SKIP
23
+
24
+ # ISO-3166 alpha-2 country code of the CPO that 'owns' this Tariff.
25
+ # @return [String]
26
+ attr_accessor :country_code
27
+
28
+ # ID of the CPO that 'owns' this Tariff (following the ISO-15118 standard).
29
+ # @return [String]
30
+ attr_accessor :party_id
31
+
32
+ # Uniquely identifies the tariff within the CPO's platform (and suboperator
33
+ # platforms).
34
+ # @return [String]
35
+ attr_accessor :id
36
+
37
+ # ISO-4217 code of the currency of this tariff.
38
+ # @return [String]
39
+ attr_accessor :currency
40
+
41
+ # Type of tariff.
42
+ # @return [TariffTypeEnum]
43
+ attr_accessor :type
44
+
45
+ # List of multi-language alternative tariff info texts.
46
+ # @return [Array[DisplayText]]
47
+ attr_accessor :tariff_alt_text
48
+
49
+ # URL to a web page that contains an explanation of the tariff information
50
+ # in human readable form.
51
+ # @return [String]
52
+ attr_accessor :tariff_alt_url
53
+
54
+ # Price limit with before and after taxes values.
55
+ # @return [PriceLimit]
56
+ attr_accessor :min_price
57
+
58
+ # Price limit with before and after taxes values.
59
+ # @return [PriceLimit]
60
+ attr_accessor :max_price
61
+
62
+ # The amount that a Payment Terminal Provider should preauthorize when
63
+ # handling card
64
+ # payment for a Session with this Tariff.
65
+ # @return [Float]
66
+ attr_accessor :preauthorize_amount
67
+
68
+ # Indicates whether tax is included in the tariff price components.
69
+ # @return [TaxIncludedEnum]
70
+ attr_accessor :tax_included
71
+
72
+ # List of Tariff Elements.
73
+ # @return [Array[TariffElement]]
74
+ attr_accessor :elements
75
+
76
+ # The time when this tariff becomes active, in UTC. time_zone field of the
77
+ # Location can
78
+ # be used to convert to local time. Typically used for a new tariff that is
79
+ # already given
80
+ # with the location, before it becomes active.
81
+ # @return [DateTime]
82
+ attr_accessor :start_date_time
83
+
84
+ # The time after which this tariff is no longer valid, in UTC. time_zone
85
+ # field of the
86
+ # Location can be used to convert to local time. Typically used when this
87
+ # tariff is going
88
+ # to be replaced with a different tariff in the near future.
89
+ # @return [DateTime]
90
+ attr_accessor :end_date_time
91
+
92
+ # This type is used to specify the energy mix and environmental impact of
93
+ # the supplied energy at a location or in a tariff.
94
+ # @return [EnergyMix]
95
+ attr_accessor :energy_mix
96
+
97
+ # Timestamp when this Tariff was last updated (or created).
98
+ # @return [DateTime]
99
+ attr_accessor :last_updated
100
+
101
+ # Unique identifier for the service, which has a one-to-one relationship
102
+ # with the corresponding product identifier (shell_service_product_ID).
103
+ # @return [String]
104
+ attr_accessor :shell_service_product_id
105
+
106
+ # Name of the service provider, which has a one-to-one relationship with the
107
+ # corresponding product name (shell_service_provider_name).
108
+ # @return [String]
109
+ attr_accessor :shell_service_provider_name
110
+
111
+ # Name of the charging service, which has a one-to-one relationship with the
112
+ # corresponding product name (shell_service_name).
113
+ # @return [String]
114
+ attr_accessor :shell_service_name
115
+
116
+ # Type of tariff.
117
+ # @return [TariffTypeEnum]
118
+ attr_accessor :legacy_type
119
+
120
+ # Type of tariff.
121
+ # @return [Array[AddOnFee]]
122
+ attr_accessor :add_on_fee
123
+
124
+ # A mapping from model property names to API property names.
125
+ def self.names
126
+ @_hash = {} if @_hash.nil?
127
+ @_hash['country_code'] = 'country_code'
128
+ @_hash['party_id'] = 'party_id'
129
+ @_hash['id'] = 'id'
130
+ @_hash['currency'] = 'currency'
131
+ @_hash['type'] = 'type'
132
+ @_hash['tariff_alt_text'] = 'tariff_alt_text'
133
+ @_hash['tariff_alt_url'] = 'tariff_alt_url'
134
+ @_hash['min_price'] = 'min_price'
135
+ @_hash['max_price'] = 'max_price'
136
+ @_hash['preauthorize_amount'] = 'preauthorize_amount'
137
+ @_hash['tax_included'] = 'tax_included'
138
+ @_hash['elements'] = 'elements'
139
+ @_hash['start_date_time'] = 'start_date_time'
140
+ @_hash['end_date_time'] = 'end_date_time'
141
+ @_hash['energy_mix'] = 'energy_mix'
142
+ @_hash['last_updated'] = 'last_updated'
143
+ @_hash['shell_service_product_id'] = 'shell_service_product_id'
144
+ @_hash['shell_service_provider_name'] = 'shell_service_provider_name'
145
+ @_hash['shell_service_name'] = 'shell_service_name'
146
+ @_hash['legacy_type'] = 'legacy_type'
147
+ @_hash['add_on_fee'] = 'add_on_fee'
148
+ @_hash
149
+ end
150
+
151
+ # An array for optional fields
152
+ def self.optionals
153
+ %w[
154
+ type
155
+ tariff_alt_text
156
+ tariff_alt_url
157
+ min_price
158
+ max_price
159
+ preauthorize_amount
160
+ start_date_time
161
+ end_date_time
162
+ energy_mix
163
+ shell_service_product_id
164
+ shell_service_provider_name
165
+ shell_service_name
166
+ legacy_type
167
+ add_on_fee
168
+ ]
169
+ end
170
+
171
+ # An array for nullable fields
172
+ def self.nullables
173
+ []
174
+ end
175
+
176
+ def initialize(country_code = nil, party_id = nil, id = nil, currency = nil,
177
+ tax_included = nil, elements = nil, last_updated = nil,
178
+ type = SKIP, tariff_alt_text = SKIP, tariff_alt_url = SKIP,
179
+ min_price = SKIP, max_price = SKIP,
180
+ preauthorize_amount = SKIP, start_date_time = SKIP,
181
+ end_date_time = SKIP, energy_mix = SKIP,
182
+ shell_service_product_id = SKIP,
183
+ shell_service_provider_name = SKIP,
184
+ shell_service_name = SKIP, legacy_type = SKIP,
185
+ add_on_fee = SKIP)
186
+ @country_code = country_code
187
+ @party_id = party_id
188
+ @id = id
189
+ @currency = currency
190
+ @type = type unless type == SKIP
191
+ @tariff_alt_text = tariff_alt_text unless tariff_alt_text == SKIP
192
+ @tariff_alt_url = tariff_alt_url unless tariff_alt_url == SKIP
193
+ @min_price = min_price unless min_price == SKIP
194
+ @max_price = max_price unless max_price == SKIP
195
+ @preauthorize_amount = preauthorize_amount unless preauthorize_amount == SKIP
196
+ @tax_included = tax_included
197
+ @elements = elements
198
+ @start_date_time = start_date_time unless start_date_time == SKIP
199
+ @end_date_time = end_date_time unless end_date_time == SKIP
200
+ @energy_mix = energy_mix unless energy_mix == SKIP
201
+ @last_updated = last_updated
202
+ @shell_service_product_id = shell_service_product_id unless shell_service_product_id == SKIP
203
+ unless shell_service_provider_name == SKIP
204
+ @shell_service_provider_name =
205
+ shell_service_provider_name
206
+ end
207
+ @shell_service_name = shell_service_name unless shell_service_name == SKIP
208
+ @legacy_type = legacy_type unless legacy_type == SKIP
209
+ @add_on_fee = add_on_fee unless add_on_fee == SKIP
210
+ end
211
+
212
+ # Creates an instance of the object from a hash.
213
+ def self.from_hash(hash)
214
+ return nil unless hash
215
+
216
+ # Extract variables from the hash.
217
+ country_code = hash.key?('country_code') ? hash['country_code'] : nil
218
+ party_id = hash.key?('party_id') ? hash['party_id'] : nil
219
+ id = hash.key?('id') ? hash['id'] : nil
220
+ currency = hash.key?('currency') ? hash['currency'] : nil
221
+ tax_included = hash.key?('tax_included') ? hash['tax_included'] : nil
222
+ # Parameter is an array, so we need to iterate through it
223
+ elements = nil
224
+ unless hash['elements'].nil?
225
+ elements = []
226
+ hash['elements'].each do |structure|
227
+ elements << (TariffElement.from_hash(structure) if structure)
228
+ end
229
+ end
230
+
231
+ elements = nil unless hash.key?('elements')
232
+ last_updated = if hash.key?('last_updated')
233
+ (DateTimeHelper.from_rfc3339(hash['last_updated']) if hash['last_updated'])
234
+ end
235
+ type = hash.key?('type') ? hash['type'] : SKIP
236
+ # Parameter is an array, so we need to iterate through it
237
+ tariff_alt_text = nil
238
+ unless hash['tariff_alt_text'].nil?
239
+ tariff_alt_text = []
240
+ hash['tariff_alt_text'].each do |structure|
241
+ tariff_alt_text << (DisplayText.from_hash(structure) if structure)
242
+ end
243
+ end
244
+
245
+ tariff_alt_text = SKIP unless hash.key?('tariff_alt_text')
246
+ tariff_alt_url =
247
+ hash.key?('tariff_alt_url') ? hash['tariff_alt_url'] : SKIP
248
+ min_price = PriceLimit.from_hash(hash['min_price']) if hash['min_price']
249
+ max_price = PriceLimit.from_hash(hash['max_price']) if hash['max_price']
250
+ preauthorize_amount =
251
+ hash.key?('preauthorize_amount') ? hash['preauthorize_amount'] : SKIP
252
+ start_date_time = if hash.key?('start_date_time')
253
+ (DateTimeHelper.from_rfc3339(hash['start_date_time']) if hash['start_date_time'])
254
+ else
255
+ SKIP
256
+ end
257
+ end_date_time = if hash.key?('end_date_time')
258
+ (DateTimeHelper.from_rfc3339(hash['end_date_time']) if hash['end_date_time'])
259
+ else
260
+ SKIP
261
+ end
262
+ energy_mix = EnergyMix.from_hash(hash['energy_mix']) if hash['energy_mix']
263
+ shell_service_product_id =
264
+ hash.key?('shell_service_product_id') ? hash['shell_service_product_id'] : SKIP
265
+ shell_service_provider_name =
266
+ hash.key?('shell_service_provider_name') ? hash['shell_service_provider_name'] : SKIP
267
+ shell_service_name =
268
+ hash.key?('shell_service_name') ? hash['shell_service_name'] : SKIP
269
+ legacy_type = hash.key?('legacy_type') ? hash['legacy_type'] : SKIP
270
+ # Parameter is an array, so we need to iterate through it
271
+ add_on_fee = nil
272
+ unless hash['add_on_fee'].nil?
273
+ add_on_fee = []
274
+ hash['add_on_fee'].each do |structure|
275
+ add_on_fee << (AddOnFee.from_hash(structure) if structure)
276
+ end
277
+ end
278
+
279
+ add_on_fee = SKIP unless hash.key?('add_on_fee')
280
+
281
+ # Create object from extracted values.
282
+ Tariff.new(country_code,
283
+ party_id,
284
+ id,
285
+ currency,
286
+ tax_included,
287
+ elements,
288
+ last_updated,
289
+ type,
290
+ tariff_alt_text,
291
+ tariff_alt_url,
292
+ min_price,
293
+ max_price,
294
+ preauthorize_amount,
295
+ start_date_time,
296
+ end_date_time,
297
+ energy_mix,
298
+ shell_service_product_id,
299
+ shell_service_provider_name,
300
+ shell_service_name,
301
+ legacy_type,
302
+ add_on_fee)
303
+ end
304
+
305
+ def to_custom_start_date_time
306
+ DateTimeHelper.to_rfc3339(start_date_time)
307
+ end
308
+
309
+ def to_custom_end_date_time
310
+ DateTimeHelper.to_rfc3339(end_date_time)
311
+ end
312
+
313
+ def to_custom_last_updated
314
+ DateTimeHelper.to_rfc3339(last_updated)
315
+ end
316
+
317
+ # Provides a human-readable string representation of the object.
318
+ def to_s
319
+ class_name = self.class.name.split('::').last
320
+ "<#{class_name} country_code: #{@country_code}, party_id: #{@party_id}, id: #{@id},"\
321
+ " currency: #{@currency}, type: #{@type}, tariff_alt_text: #{@tariff_alt_text},"\
322
+ " tariff_alt_url: #{@tariff_alt_url}, min_price: #{@min_price}, max_price: #{@max_price},"\
323
+ " preauthorize_amount: #{@preauthorize_amount}, tax_included: #{@tax_included}, elements:"\
324
+ " #{@elements}, start_date_time: #{@start_date_time}, end_date_time: #{@end_date_time},"\
325
+ " energy_mix: #{@energy_mix}, last_updated: #{@last_updated}, shell_service_product_id:"\
326
+ " #{@shell_service_product_id}, shell_service_provider_name:"\
327
+ " #{@shell_service_provider_name}, shell_service_name: #{@shell_service_name}, legacy_type:"\
328
+ " #{@legacy_type}, add_on_fee: #{@add_on_fee}>"
329
+ end
330
+
331
+ # Provides a debugging-friendly string with detailed object information.
332
+ def inspect
333
+ class_name = self.class.name.split('::').last
334
+ "<#{class_name} country_code: #{@country_code.inspect}, party_id: #{@party_id.inspect}, id:"\
335
+ " #{@id.inspect}, currency: #{@currency.inspect}, type: #{@type.inspect}, tariff_alt_text:"\
336
+ " #{@tariff_alt_text.inspect}, tariff_alt_url: #{@tariff_alt_url.inspect}, min_price:"\
337
+ " #{@min_price.inspect}, max_price: #{@max_price.inspect}, preauthorize_amount:"\
338
+ " #{@preauthorize_amount.inspect}, tax_included: #{@tax_included.inspect}, elements:"\
339
+ " #{@elements.inspect}, start_date_time: #{@start_date_time.inspect}, end_date_time:"\
340
+ " #{@end_date_time.inspect}, energy_mix: #{@energy_mix.inspect}, last_updated:"\
341
+ " #{@last_updated.inspect}, shell_service_product_id: #{@shell_service_product_id.inspect},"\
342
+ " shell_service_provider_name: #{@shell_service_provider_name.inspect}, shell_service_name:"\
343
+ " #{@shell_service_name.inspect}, legacy_type: #{@legacy_type.inspect}, add_on_fee:"\
344
+ " #{@add_on_fee.inspect}>"
345
+ end
346
+ end
347
+ end
@@ -0,0 +1,336 @@
1
+ # e_mobility_vmspocpiap_is
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module EMobilityVmspocpiapIs
8
+ # Response data object or list of objects.
9
+ class Tariff1 < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # ISO-3166 alpha-2 country code of the CPO that 'owns' this Tariff.
14
+ # @return [String]
15
+ attr_accessor :country_code
16
+
17
+ # ID of the CPO that 'owns' this Tariff (following the ISO-15118 standard).
18
+ # @return [String]
19
+ attr_accessor :party_id
20
+
21
+ # Uniquely identifies the tariff within the CPO's platform (and suboperator
22
+ # platforms).
23
+ # @return [String]
24
+ attr_accessor :id
25
+
26
+ # ISO-4217 code of the currency of this tariff.
27
+ # @return [String]
28
+ attr_accessor :currency
29
+
30
+ # Type of tariff.
31
+ # @return [TariffTypeEnum]
32
+ attr_accessor :type
33
+
34
+ # List of multi-language alternative tariff info texts.
35
+ # @return [Array[DisplayText]]
36
+ attr_accessor :tariff_alt_text
37
+
38
+ # URL to a web page that contains an explanation of the tariff information
39
+ # in human readable form.
40
+ # @return [String]
41
+ attr_accessor :tariff_alt_url
42
+
43
+ # Price limit with before and after taxes values.
44
+ # @return [PriceLimit]
45
+ attr_accessor :min_price
46
+
47
+ # Price limit with before and after taxes values.
48
+ # @return [PriceLimit]
49
+ attr_accessor :max_price
50
+
51
+ # The amount that a Payment Terminal Provider should preauthorize when
52
+ # handling card
53
+ # payment for a Session with this Tariff.
54
+ # @return [Float]
55
+ attr_accessor :preauthorize_amount
56
+
57
+ # Indicates whether tax is included in the tariff price components.
58
+ # @return [TaxIncludedEnum]
59
+ attr_accessor :tax_included
60
+
61
+ # List of Tariff Elements.
62
+ # @return [Array[TariffElement]]
63
+ attr_accessor :elements
64
+
65
+ # The time when this tariff becomes active, in UTC. time_zone field of the
66
+ # Location can
67
+ # be used to convert to local time. Typically used for a new tariff that is
68
+ # already given
69
+ # with the location, before it becomes active.
70
+ # @return [DateTime]
71
+ attr_accessor :start_date_time
72
+
73
+ # The time after which this tariff is no longer valid, in UTC. time_zone
74
+ # field of the
75
+ # Location can be used to convert to local time. Typically used when this
76
+ # tariff is going
77
+ # to be replaced with a different tariff in the near future.
78
+ # @return [DateTime]
79
+ attr_accessor :end_date_time
80
+
81
+ # This type is used to specify the energy mix and environmental impact of
82
+ # the supplied energy at a location or in a tariff.
83
+ # @return [EnergyMix]
84
+ attr_accessor :energy_mix
85
+
86
+ # Timestamp when this Tariff was last updated (or created).
87
+ # @return [DateTime]
88
+ attr_accessor :last_updated
89
+
90
+ # Unique identifier for the service, which has a one-to-one relationship
91
+ # with the corresponding product identifier (shell_service_product_ID).
92
+ # @return [String]
93
+ attr_accessor :shell_service_product_id
94
+
95
+ # Name of the service provider, which has a one-to-one relationship with the
96
+ # corresponding product name (shell_service_provider_name).
97
+ # @return [String]
98
+ attr_accessor :shell_service_provider_name
99
+
100
+ # Name of the charging service, which has a one-to-one relationship with the
101
+ # corresponding product name (shell_service_name).
102
+ # @return [String]
103
+ attr_accessor :shell_service_name
104
+
105
+ # Type of tariff.
106
+ # @return [TariffTypeEnum]
107
+ attr_accessor :legacy_type
108
+
109
+ # Type of tariff.
110
+ # @return [Array[AddOnFee]]
111
+ attr_accessor :add_on_fee
112
+
113
+ # A mapping from model property names to API property names.
114
+ def self.names
115
+ @_hash = {} if @_hash.nil?
116
+ @_hash['country_code'] = 'country_code'
117
+ @_hash['party_id'] = 'party_id'
118
+ @_hash['id'] = 'id'
119
+ @_hash['currency'] = 'currency'
120
+ @_hash['type'] = 'type'
121
+ @_hash['tariff_alt_text'] = 'tariff_alt_text'
122
+ @_hash['tariff_alt_url'] = 'tariff_alt_url'
123
+ @_hash['min_price'] = 'min_price'
124
+ @_hash['max_price'] = 'max_price'
125
+ @_hash['preauthorize_amount'] = 'preauthorize_amount'
126
+ @_hash['tax_included'] = 'tax_included'
127
+ @_hash['elements'] = 'elements'
128
+ @_hash['start_date_time'] = 'start_date_time'
129
+ @_hash['end_date_time'] = 'end_date_time'
130
+ @_hash['energy_mix'] = 'energy_mix'
131
+ @_hash['last_updated'] = 'last_updated'
132
+ @_hash['shell_service_product_id'] = 'shell_service_product_id'
133
+ @_hash['shell_service_provider_name'] = 'shell_service_provider_name'
134
+ @_hash['shell_service_name'] = 'shell_service_name'
135
+ @_hash['legacy_type'] = 'legacy_type'
136
+ @_hash['add_on_fee'] = 'add_on_fee'
137
+ @_hash
138
+ end
139
+
140
+ # An array for optional fields
141
+ def self.optionals
142
+ %w[
143
+ type
144
+ tariff_alt_text
145
+ tariff_alt_url
146
+ min_price
147
+ max_price
148
+ preauthorize_amount
149
+ start_date_time
150
+ end_date_time
151
+ energy_mix
152
+ shell_service_product_id
153
+ shell_service_provider_name
154
+ shell_service_name
155
+ legacy_type
156
+ add_on_fee
157
+ ]
158
+ end
159
+
160
+ # An array for nullable fields
161
+ def self.nullables
162
+ []
163
+ end
164
+
165
+ def initialize(country_code = nil, party_id = nil, id = nil, currency = nil,
166
+ tax_included = nil, elements = nil, last_updated = nil,
167
+ type = SKIP, tariff_alt_text = SKIP, tariff_alt_url = SKIP,
168
+ min_price = SKIP, max_price = SKIP,
169
+ preauthorize_amount = SKIP, start_date_time = SKIP,
170
+ end_date_time = SKIP, energy_mix = SKIP,
171
+ shell_service_product_id = SKIP,
172
+ shell_service_provider_name = SKIP,
173
+ shell_service_name = SKIP, legacy_type = SKIP,
174
+ add_on_fee = SKIP)
175
+ @country_code = country_code
176
+ @party_id = party_id
177
+ @id = id
178
+ @currency = currency
179
+ @type = type unless type == SKIP
180
+ @tariff_alt_text = tariff_alt_text unless tariff_alt_text == SKIP
181
+ @tariff_alt_url = tariff_alt_url unless tariff_alt_url == SKIP
182
+ @min_price = min_price unless min_price == SKIP
183
+ @max_price = max_price unless max_price == SKIP
184
+ @preauthorize_amount = preauthorize_amount unless preauthorize_amount == SKIP
185
+ @tax_included = tax_included
186
+ @elements = elements
187
+ @start_date_time = start_date_time unless start_date_time == SKIP
188
+ @end_date_time = end_date_time unless end_date_time == SKIP
189
+ @energy_mix = energy_mix unless energy_mix == SKIP
190
+ @last_updated = last_updated
191
+ @shell_service_product_id = shell_service_product_id unless shell_service_product_id == SKIP
192
+ unless shell_service_provider_name == SKIP
193
+ @shell_service_provider_name =
194
+ shell_service_provider_name
195
+ end
196
+ @shell_service_name = shell_service_name unless shell_service_name == SKIP
197
+ @legacy_type = legacy_type unless legacy_type == SKIP
198
+ @add_on_fee = add_on_fee unless add_on_fee == SKIP
199
+ end
200
+
201
+ # Creates an instance of the object from a hash.
202
+ def self.from_hash(hash)
203
+ return nil unless hash
204
+
205
+ # Extract variables from the hash.
206
+ country_code = hash.key?('country_code') ? hash['country_code'] : nil
207
+ party_id = hash.key?('party_id') ? hash['party_id'] : nil
208
+ id = hash.key?('id') ? hash['id'] : nil
209
+ currency = hash.key?('currency') ? hash['currency'] : nil
210
+ tax_included = hash.key?('tax_included') ? hash['tax_included'] : nil
211
+ # Parameter is an array, so we need to iterate through it
212
+ elements = nil
213
+ unless hash['elements'].nil?
214
+ elements = []
215
+ hash['elements'].each do |structure|
216
+ elements << (TariffElement.from_hash(structure) if structure)
217
+ end
218
+ end
219
+
220
+ elements = nil unless hash.key?('elements')
221
+ last_updated = if hash.key?('last_updated')
222
+ (DateTimeHelper.from_rfc3339(hash['last_updated']) if hash['last_updated'])
223
+ end
224
+ type = hash.key?('type') ? hash['type'] : SKIP
225
+ # Parameter is an array, so we need to iterate through it
226
+ tariff_alt_text = nil
227
+ unless hash['tariff_alt_text'].nil?
228
+ tariff_alt_text = []
229
+ hash['tariff_alt_text'].each do |structure|
230
+ tariff_alt_text << (DisplayText.from_hash(structure) if structure)
231
+ end
232
+ end
233
+
234
+ tariff_alt_text = SKIP unless hash.key?('tariff_alt_text')
235
+ tariff_alt_url =
236
+ hash.key?('tariff_alt_url') ? hash['tariff_alt_url'] : SKIP
237
+ min_price = PriceLimit.from_hash(hash['min_price']) if hash['min_price']
238
+ max_price = PriceLimit.from_hash(hash['max_price']) if hash['max_price']
239
+ preauthorize_amount =
240
+ hash.key?('preauthorize_amount') ? hash['preauthorize_amount'] : SKIP
241
+ start_date_time = if hash.key?('start_date_time')
242
+ (DateTimeHelper.from_rfc3339(hash['start_date_time']) if hash['start_date_time'])
243
+ else
244
+ SKIP
245
+ end
246
+ end_date_time = if hash.key?('end_date_time')
247
+ (DateTimeHelper.from_rfc3339(hash['end_date_time']) if hash['end_date_time'])
248
+ else
249
+ SKIP
250
+ end
251
+ energy_mix = EnergyMix.from_hash(hash['energy_mix']) if hash['energy_mix']
252
+ shell_service_product_id =
253
+ hash.key?('shell_service_product_id') ? hash['shell_service_product_id'] : SKIP
254
+ shell_service_provider_name =
255
+ hash.key?('shell_service_provider_name') ? hash['shell_service_provider_name'] : SKIP
256
+ shell_service_name =
257
+ hash.key?('shell_service_name') ? hash['shell_service_name'] : SKIP
258
+ legacy_type = hash.key?('legacy_type') ? hash['legacy_type'] : SKIP
259
+ # Parameter is an array, so we need to iterate through it
260
+ add_on_fee = nil
261
+ unless hash['add_on_fee'].nil?
262
+ add_on_fee = []
263
+ hash['add_on_fee'].each do |structure|
264
+ add_on_fee << (AddOnFee.from_hash(structure) if structure)
265
+ end
266
+ end
267
+
268
+ add_on_fee = SKIP unless hash.key?('add_on_fee')
269
+
270
+ # Create object from extracted values.
271
+ Tariff1.new(country_code,
272
+ party_id,
273
+ id,
274
+ currency,
275
+ tax_included,
276
+ elements,
277
+ last_updated,
278
+ type,
279
+ tariff_alt_text,
280
+ tariff_alt_url,
281
+ min_price,
282
+ max_price,
283
+ preauthorize_amount,
284
+ start_date_time,
285
+ end_date_time,
286
+ energy_mix,
287
+ shell_service_product_id,
288
+ shell_service_provider_name,
289
+ shell_service_name,
290
+ legacy_type,
291
+ add_on_fee)
292
+ end
293
+
294
+ def to_custom_start_date_time
295
+ DateTimeHelper.to_rfc3339(start_date_time)
296
+ end
297
+
298
+ def to_custom_end_date_time
299
+ DateTimeHelper.to_rfc3339(end_date_time)
300
+ end
301
+
302
+ def to_custom_last_updated
303
+ DateTimeHelper.to_rfc3339(last_updated)
304
+ end
305
+
306
+ # Provides a human-readable string representation of the object.
307
+ def to_s
308
+ class_name = self.class.name.split('::').last
309
+ "<#{class_name} country_code: #{@country_code}, party_id: #{@party_id}, id: #{@id},"\
310
+ " currency: #{@currency}, type: #{@type}, tariff_alt_text: #{@tariff_alt_text},"\
311
+ " tariff_alt_url: #{@tariff_alt_url}, min_price: #{@min_price}, max_price: #{@max_price},"\
312
+ " preauthorize_amount: #{@preauthorize_amount}, tax_included: #{@tax_included}, elements:"\
313
+ " #{@elements}, start_date_time: #{@start_date_time}, end_date_time: #{@end_date_time},"\
314
+ " energy_mix: #{@energy_mix}, last_updated: #{@last_updated}, shell_service_product_id:"\
315
+ " #{@shell_service_product_id}, shell_service_provider_name:"\
316
+ " #{@shell_service_provider_name}, shell_service_name: #{@shell_service_name}, legacy_type:"\
317
+ " #{@legacy_type}, add_on_fee: #{@add_on_fee}>"
318
+ end
319
+
320
+ # Provides a debugging-friendly string with detailed object information.
321
+ def inspect
322
+ class_name = self.class.name.split('::').last
323
+ "<#{class_name} country_code: #{@country_code.inspect}, party_id: #{@party_id.inspect}, id:"\
324
+ " #{@id.inspect}, currency: #{@currency.inspect}, type: #{@type.inspect}, tariff_alt_text:"\
325
+ " #{@tariff_alt_text.inspect}, tariff_alt_url: #{@tariff_alt_url.inspect}, min_price:"\
326
+ " #{@min_price.inspect}, max_price: #{@max_price.inspect}, preauthorize_amount:"\
327
+ " #{@preauthorize_amount.inspect}, tax_included: #{@tax_included.inspect}, elements:"\
328
+ " #{@elements.inspect}, start_date_time: #{@start_date_time.inspect}, end_date_time:"\
329
+ " #{@end_date_time.inspect}, energy_mix: #{@energy_mix.inspect}, last_updated:"\
330
+ " #{@last_updated.inspect}, shell_service_product_id: #{@shell_service_product_id.inspect},"\
331
+ " shell_service_provider_name: #{@shell_service_provider_name.inspect}, shell_service_name:"\
332
+ " #{@shell_service_name.inspect}, legacy_type: #{@legacy_type.inspect}, add_on_fee:"\
333
+ " #{@add_on_fee.inspect}>"
334
+ end
335
+ end
336
+ end