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,462 @@
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
+ # The CDR object describes the charging session and its costs, how these costs
9
+ # are composed, etc. The CDR can be thought of as sealed, preserving the
10
+ # information valid at the moment in time the underlying session was started.
11
+ # This is a requirement of the main use case for CDRs, namely invoicing. The
12
+ # CDR object shall always contain information like Location, EVSE, Tariffs and
13
+ # Token as they were at the start of the charging session.
14
+ class CDR < BaseModel
15
+ SKIP = Object.new
16
+ private_constant :SKIP
17
+
18
+ # ISO-3166 alpha-2 country code of the CPO that 'owns' this CDR.
19
+ # @return [String]
20
+ attr_accessor :country_code
21
+
22
+ # ID of the CPO that 'owns' this CDR (following the ISO-15118 standard).
23
+ # @return [String]
24
+ attr_accessor :party_id
25
+
26
+ # Uniquely identifies the CDR.
27
+ # @return [String]
28
+ attr_accessor :id
29
+
30
+ # Start timestamp of the charging session, or in-case of a reservation
31
+ # (before the start of a session) the start of the reservation.
32
+ # @return [DateTime]
33
+ attr_accessor :start_date_time
34
+
35
+ # The timestamp when the session was completed/finished, charging might have
36
+ # finished before the session ends, for example EV is full, but parking cost
37
+ # also has to be paid.
38
+ # @return [DateTime]
39
+ attr_accessor :end_date_time
40
+
41
+ # Unique ID of the Session for which this CDR is sent. Is only allowed to be
42
+ # omitted when the CPO has not implemented the Sessions module or this CDR
43
+ # is the result of a reservation that never became a charging session.
44
+ # @return [String]
45
+ attr_accessor :session_id
46
+
47
+ # Unique ID of the Booking for which this CDR can also be sent. Is only
48
+ # allowed to be omitted when the Session was reserved.
49
+ # @return [String]
50
+ attr_accessor :booking_id
51
+
52
+ # Token information used to start a charging session, containing all
53
+ # relevant information to identify the unique token.
54
+ # @return [CdrToken]
55
+ attr_accessor :cdr_token
56
+
57
+ # Method used for authentication.
58
+ # @return [AuthMethodEnum]
59
+ attr_accessor :auth_method
60
+
61
+ # Reference to the authorization given by the eMSP. When the eMSP provided
62
+ # an
63
+ # authorization_reference in either real-time authorization, StartSession or
64
+ # ReserveNow,
65
+ # this field SHALL contain the same value. When different
66
+ # authorization_reference values
67
+ # have been given by the eMSP that are relevant to this Session, the last
68
+ # given value
69
+ # SHALL be used here.
70
+ # @return [String]
71
+ attr_accessor :authorization_reference
72
+
73
+ # The CdrLocation class contains only the relevant information from the
74
+ # Location object
75
+ # that is needed in a CDR.
76
+ # @return [CdrLocation]
77
+ attr_accessor :cdr_location
78
+
79
+ # Identification of the Meter inside the Charge Point.
80
+ # @return [String]
81
+ attr_accessor :meter_id
82
+
83
+ # Currency of the CDR in ISO 4217 Code.
84
+ # @return [String]
85
+ attr_accessor :currency
86
+
87
+ # List of relevant Tariffs, see the Tariffs module. When relevant, a "Free
88
+ # of Charge"
89
+ # tariff should also be in this list, and point to a defined "Free of
90
+ # Charge" Tariff.
91
+ # @return [Array[Tariff]]
92
+ attr_accessor :tariffs
93
+
94
+ # List of Charging Periods that make up this charging session.
95
+ # @return [Array[ChargingPeriod]]
96
+ attr_accessor :charging_periods
97
+
98
+ # This class contains all the information of the signed data. Which encoding
99
+ # method is used,
100
+ # if needed, the public key and a list of signed values.
101
+ # @return [SignedData]
102
+ attr_accessor :signed_data
103
+
104
+ # Price information with tax details.
105
+ # @return [Price]
106
+ attr_accessor :total_cost
107
+
108
+ # Price information with tax details.
109
+ # @return [Price]
110
+ attr_accessor :total_fixed_cost
111
+
112
+ # Total energy charged, in kWh.
113
+ # @return [Float]
114
+ attr_accessor :total_energy
115
+
116
+ # Price information with tax details.
117
+ # @return [Price]
118
+ attr_accessor :total_energy_cost
119
+
120
+ # Total duration of the charging session (including the duration of charging
121
+ # and not charging), in hours.
122
+ # @return [Float]
123
+ attr_accessor :total_time
124
+
125
+ # Price information with tax details.
126
+ # @return [Price]
127
+ attr_accessor :total_time_cost
128
+
129
+ # Total duration of the charging session where the EV was not charging (no
130
+ # energy was transferred between EVSE and EV), in hours.
131
+ # @return [Float]
132
+ attr_accessor :total_parking_time
133
+
134
+ # Price information with tax details.
135
+ # @return [Price]
136
+ attr_accessor :total_parking_cost
137
+
138
+ # Price information with tax details.
139
+ # @return [Price]
140
+ attr_accessor :total_reservation_cost
141
+
142
+ # Optional remark, can be used to provide additional human readable
143
+ # information to the CDR, for example reason why a transaction was stopped.
144
+ # @return [String]
145
+ attr_accessor :remark
146
+
147
+ # Optional remark, can be used to provide additional human readable
148
+ # information to the CDR, for example reason why a transaction was stopped.
149
+ # @return [Array[AddOnFee]]
150
+ attr_accessor :add_on_fee
151
+
152
+ # This field can be used to reference an invoice, that will later be sent
153
+ # for this CDR. Making it easier to link a CDR to a given invoice. Maybe
154
+ # even group CDRs that will be on the same invoice.
155
+ # @return [String]
156
+ attr_accessor :invoice_reference_id
157
+
158
+ # When set to true, this is a Credit CDR, and the field credit_reference_id
159
+ # needs to be set as well.
160
+ # @return [TrueClass | FalseClass]
161
+ attr_accessor :credit
162
+
163
+ # Is required to be set for a Credit CDR. This SHALL contain the id of the
164
+ # CDR for which this is a Credit CDR.
165
+ # @return [String]
166
+ attr_accessor :credit_reference_id
167
+
168
+ # When set to true, this CDR is for a charging session using the home
169
+ # charger of the EV Driver for which the energy cost needs to be financially
170
+ # compensated to the EV Driver.
171
+ # @return [TrueClass | FalseClass]
172
+ attr_accessor :home_charging_compensation
173
+
174
+ # Timestamp when this CDR was last updated (or created).
175
+ # @return [DateTime]
176
+ attr_accessor :last_updated
177
+
178
+ # A mapping from model property names to API property names.
179
+ def self.names
180
+ @_hash = {} if @_hash.nil?
181
+ @_hash['country_code'] = 'country_code'
182
+ @_hash['party_id'] = 'party_id'
183
+ @_hash['id'] = 'id'
184
+ @_hash['start_date_time'] = 'start_date_time'
185
+ @_hash['end_date_time'] = 'end_date_time'
186
+ @_hash['session_id'] = 'session_id'
187
+ @_hash['booking_id'] = 'booking_id'
188
+ @_hash['cdr_token'] = 'cdr_token'
189
+ @_hash['auth_method'] = 'auth_method'
190
+ @_hash['authorization_reference'] = 'authorization_reference'
191
+ @_hash['cdr_location'] = 'cdr_location'
192
+ @_hash['meter_id'] = 'meter_id'
193
+ @_hash['currency'] = 'currency'
194
+ @_hash['tariffs'] = 'tariffs'
195
+ @_hash['charging_periods'] = 'charging_periods'
196
+ @_hash['signed_data'] = 'signed_data'
197
+ @_hash['total_cost'] = 'total_cost'
198
+ @_hash['total_fixed_cost'] = 'total_fixed_cost'
199
+ @_hash['total_energy'] = 'total_energy'
200
+ @_hash['total_energy_cost'] = 'total_energy_cost'
201
+ @_hash['total_time'] = 'total_time'
202
+ @_hash['total_time_cost'] = 'total_time_cost'
203
+ @_hash['total_parking_time'] = 'total_parking_time'
204
+ @_hash['total_parking_cost'] = 'total_parking_cost'
205
+ @_hash['total_reservation_cost'] = 'total_reservation_cost'
206
+ @_hash['remark'] = 'remark'
207
+ @_hash['add_on_fee'] = 'add_on_fee'
208
+ @_hash['invoice_reference_id'] = 'invoice_reference_id'
209
+ @_hash['credit'] = 'credit'
210
+ @_hash['credit_reference_id'] = 'credit_reference_id'
211
+ @_hash['home_charging_compensation'] = 'home_charging_compensation'
212
+ @_hash['last_updated'] = 'last_updated'
213
+ @_hash
214
+ end
215
+
216
+ # An array for optional fields
217
+ def self.optionals
218
+ %w[
219
+ session_id
220
+ booking_id
221
+ authorization_reference
222
+ meter_id
223
+ tariffs
224
+ signed_data
225
+ total_fixed_cost
226
+ total_energy_cost
227
+ total_time_cost
228
+ total_parking_time
229
+ total_parking_cost
230
+ total_reservation_cost
231
+ remark
232
+ add_on_fee
233
+ invoice_reference_id
234
+ credit
235
+ credit_reference_id
236
+ home_charging_compensation
237
+ ]
238
+ end
239
+
240
+ # An array for nullable fields
241
+ def self.nullables
242
+ []
243
+ end
244
+
245
+ def initialize(country_code = nil, party_id = nil, id = nil,
246
+ start_date_time = nil, end_date_time = nil, cdr_token = nil,
247
+ auth_method = nil, cdr_location = nil, currency = nil,
248
+ charging_periods = nil, total_cost = nil, total_energy = nil,
249
+ total_time = nil, last_updated = nil, session_id = SKIP,
250
+ booking_id = SKIP, authorization_reference = SKIP,
251
+ meter_id = SKIP, tariffs = SKIP, signed_data = SKIP,
252
+ total_fixed_cost = SKIP, total_energy_cost = SKIP,
253
+ total_time_cost = SKIP, total_parking_time = SKIP,
254
+ total_parking_cost = SKIP, total_reservation_cost = SKIP,
255
+ remark = SKIP, add_on_fee = SKIP,
256
+ invoice_reference_id = SKIP, credit = SKIP,
257
+ credit_reference_id = SKIP,
258
+ home_charging_compensation = SKIP)
259
+ @country_code = country_code
260
+ @party_id = party_id
261
+ @id = id
262
+ @start_date_time = start_date_time
263
+ @end_date_time = end_date_time
264
+ @session_id = session_id unless session_id == SKIP
265
+ @booking_id = booking_id unless booking_id == SKIP
266
+ @cdr_token = cdr_token
267
+ @auth_method = auth_method
268
+ @authorization_reference = authorization_reference unless authorization_reference == SKIP
269
+ @cdr_location = cdr_location
270
+ @meter_id = meter_id unless meter_id == SKIP
271
+ @currency = currency
272
+ @tariffs = tariffs unless tariffs == SKIP
273
+ @charging_periods = charging_periods
274
+ @signed_data = signed_data unless signed_data == SKIP
275
+ @total_cost = total_cost
276
+ @total_fixed_cost = total_fixed_cost unless total_fixed_cost == SKIP
277
+ @total_energy = total_energy
278
+ @total_energy_cost = total_energy_cost unless total_energy_cost == SKIP
279
+ @total_time = total_time
280
+ @total_time_cost = total_time_cost unless total_time_cost == SKIP
281
+ @total_parking_time = total_parking_time unless total_parking_time == SKIP
282
+ @total_parking_cost = total_parking_cost unless total_parking_cost == SKIP
283
+ @total_reservation_cost = total_reservation_cost unless total_reservation_cost == SKIP
284
+ @remark = remark unless remark == SKIP
285
+ @add_on_fee = add_on_fee unless add_on_fee == SKIP
286
+ @invoice_reference_id = invoice_reference_id unless invoice_reference_id == SKIP
287
+ @credit = credit unless credit == SKIP
288
+ @credit_reference_id = credit_reference_id unless credit_reference_id == SKIP
289
+ unless home_charging_compensation == SKIP
290
+ @home_charging_compensation =
291
+ home_charging_compensation
292
+ end
293
+ @last_updated = last_updated
294
+ end
295
+
296
+ # Creates an instance of the object from a hash.
297
+ def self.from_hash(hash)
298
+ return nil unless hash
299
+
300
+ # Extract variables from the hash.
301
+ country_code = hash.key?('country_code') ? hash['country_code'] : nil
302
+ party_id = hash.key?('party_id') ? hash['party_id'] : nil
303
+ id = hash.key?('id') ? hash['id'] : nil
304
+ start_date_time = if hash.key?('start_date_time')
305
+ (DateTimeHelper.from_rfc3339(hash['start_date_time']) if hash['start_date_time'])
306
+ end
307
+ end_date_time = if hash.key?('end_date_time')
308
+ (DateTimeHelper.from_rfc3339(hash['end_date_time']) if hash['end_date_time'])
309
+ end
310
+ cdr_token = CdrToken.from_hash(hash['cdr_token']) if hash['cdr_token']
311
+ auth_method = hash.key?('auth_method') ? hash['auth_method'] : nil
312
+ cdr_location = CdrLocation.from_hash(hash['cdr_location']) if hash['cdr_location']
313
+ currency = hash.key?('currency') ? hash['currency'] : nil
314
+ # Parameter is an array, so we need to iterate through it
315
+ charging_periods = nil
316
+ unless hash['charging_periods'].nil?
317
+ charging_periods = []
318
+ hash['charging_periods'].each do |structure|
319
+ charging_periods << (ChargingPeriod.from_hash(structure) if structure)
320
+ end
321
+ end
322
+
323
+ charging_periods = nil unless hash.key?('charging_periods')
324
+ total_cost = Price.from_hash(hash['total_cost']) if hash['total_cost']
325
+ total_energy = hash.key?('total_energy') ? hash['total_energy'] : nil
326
+ total_time = hash.key?('total_time') ? hash['total_time'] : nil
327
+ last_updated = if hash.key?('last_updated')
328
+ (DateTimeHelper.from_rfc3339(hash['last_updated']) if hash['last_updated'])
329
+ end
330
+ session_id = hash.key?('session_id') ? hash['session_id'] : SKIP
331
+ booking_id = hash.key?('booking_id') ? hash['booking_id'] : SKIP
332
+ authorization_reference =
333
+ hash.key?('authorization_reference') ? hash['authorization_reference'] : SKIP
334
+ meter_id = hash.key?('meter_id') ? hash['meter_id'] : SKIP
335
+ # Parameter is an array, so we need to iterate through it
336
+ tariffs = nil
337
+ unless hash['tariffs'].nil?
338
+ tariffs = []
339
+ hash['tariffs'].each do |structure|
340
+ tariffs << (Tariff.from_hash(structure) if structure)
341
+ end
342
+ end
343
+
344
+ tariffs = SKIP unless hash.key?('tariffs')
345
+ signed_data = SignedData.from_hash(hash['signed_data']) if hash['signed_data']
346
+ total_fixed_cost = Price.from_hash(hash['total_fixed_cost']) if hash['total_fixed_cost']
347
+ total_energy_cost = Price.from_hash(hash['total_energy_cost']) if hash['total_energy_cost']
348
+ total_time_cost = Price.from_hash(hash['total_time_cost']) if hash['total_time_cost']
349
+ total_parking_time =
350
+ hash.key?('total_parking_time') ? hash['total_parking_time'] : SKIP
351
+ total_parking_cost = Price.from_hash(hash['total_parking_cost']) if
352
+ hash['total_parking_cost']
353
+ total_reservation_cost = Price.from_hash(hash['total_reservation_cost']) if
354
+ hash['total_reservation_cost']
355
+ remark = hash.key?('remark') ? hash['remark'] : SKIP
356
+ # Parameter is an array, so we need to iterate through it
357
+ add_on_fee = nil
358
+ unless hash['add_on_fee'].nil?
359
+ add_on_fee = []
360
+ hash['add_on_fee'].each do |structure|
361
+ add_on_fee << (AddOnFee.from_hash(structure) if structure)
362
+ end
363
+ end
364
+
365
+ add_on_fee = SKIP unless hash.key?('add_on_fee')
366
+ invoice_reference_id =
367
+ hash.key?('invoice_reference_id') ? hash['invoice_reference_id'] : SKIP
368
+ credit = hash.key?('credit') ? hash['credit'] : SKIP
369
+ credit_reference_id =
370
+ hash.key?('credit_reference_id') ? hash['credit_reference_id'] : SKIP
371
+ home_charging_compensation =
372
+ hash.key?('home_charging_compensation') ? hash['home_charging_compensation'] : SKIP
373
+
374
+ # Create object from extracted values.
375
+ CDR.new(country_code,
376
+ party_id,
377
+ id,
378
+ start_date_time,
379
+ end_date_time,
380
+ cdr_token,
381
+ auth_method,
382
+ cdr_location,
383
+ currency,
384
+ charging_periods,
385
+ total_cost,
386
+ total_energy,
387
+ total_time,
388
+ last_updated,
389
+ session_id,
390
+ booking_id,
391
+ authorization_reference,
392
+ meter_id,
393
+ tariffs,
394
+ signed_data,
395
+ total_fixed_cost,
396
+ total_energy_cost,
397
+ total_time_cost,
398
+ total_parking_time,
399
+ total_parking_cost,
400
+ total_reservation_cost,
401
+ remark,
402
+ add_on_fee,
403
+ invoice_reference_id,
404
+ credit,
405
+ credit_reference_id,
406
+ home_charging_compensation)
407
+ end
408
+
409
+ def to_custom_start_date_time
410
+ DateTimeHelper.to_rfc3339(start_date_time)
411
+ end
412
+
413
+ def to_custom_end_date_time
414
+ DateTimeHelper.to_rfc3339(end_date_time)
415
+ end
416
+
417
+ def to_custom_last_updated
418
+ DateTimeHelper.to_rfc3339(last_updated)
419
+ end
420
+
421
+ # Provides a human-readable string representation of the object.
422
+ def to_s
423
+ class_name = self.class.name.split('::').last
424
+ "<#{class_name} country_code: #{@country_code}, party_id: #{@party_id}, id: #{@id},"\
425
+ " start_date_time: #{@start_date_time}, end_date_time: #{@end_date_time}, session_id:"\
426
+ " #{@session_id}, booking_id: #{@booking_id}, cdr_token: #{@cdr_token}, auth_method:"\
427
+ " #{@auth_method}, authorization_reference: #{@authorization_reference}, cdr_location:"\
428
+ " #{@cdr_location}, meter_id: #{@meter_id}, currency: #{@currency}, tariffs: #{@tariffs},"\
429
+ " charging_periods: #{@charging_periods}, signed_data: #{@signed_data}, total_cost:"\
430
+ " #{@total_cost}, total_fixed_cost: #{@total_fixed_cost}, total_energy: #{@total_energy},"\
431
+ " total_energy_cost: #{@total_energy_cost}, total_time: #{@total_time}, total_time_cost:"\
432
+ " #{@total_time_cost}, total_parking_time: #{@total_parking_time}, total_parking_cost:"\
433
+ " #{@total_parking_cost}, total_reservation_cost: #{@total_reservation_cost}, remark:"\
434
+ " #{@remark}, add_on_fee: #{@add_on_fee}, invoice_reference_id: #{@invoice_reference_id},"\
435
+ " credit: #{@credit}, credit_reference_id: #{@credit_reference_id},"\
436
+ " home_charging_compensation: #{@home_charging_compensation}, last_updated:"\
437
+ " #{@last_updated}>"
438
+ end
439
+
440
+ # Provides a debugging-friendly string with detailed object information.
441
+ def inspect
442
+ class_name = self.class.name.split('::').last
443
+ "<#{class_name} country_code: #{@country_code.inspect}, party_id: #{@party_id.inspect}, id:"\
444
+ " #{@id.inspect}, start_date_time: #{@start_date_time.inspect}, end_date_time:"\
445
+ " #{@end_date_time.inspect}, session_id: #{@session_id.inspect}, booking_id:"\
446
+ " #{@booking_id.inspect}, cdr_token: #{@cdr_token.inspect}, auth_method:"\
447
+ " #{@auth_method.inspect}, authorization_reference: #{@authorization_reference.inspect},"\
448
+ " cdr_location: #{@cdr_location.inspect}, meter_id: #{@meter_id.inspect}, currency:"\
449
+ " #{@currency.inspect}, tariffs: #{@tariffs.inspect}, charging_periods:"\
450
+ " #{@charging_periods.inspect}, signed_data: #{@signed_data.inspect}, total_cost:"\
451
+ " #{@total_cost.inspect}, total_fixed_cost: #{@total_fixed_cost.inspect}, total_energy:"\
452
+ " #{@total_energy.inspect}, total_energy_cost: #{@total_energy_cost.inspect}, total_time:"\
453
+ " #{@total_time.inspect}, total_time_cost: #{@total_time_cost.inspect}, total_parking_time:"\
454
+ " #{@total_parking_time.inspect}, total_parking_cost: #{@total_parking_cost.inspect},"\
455
+ " total_reservation_cost: #{@total_reservation_cost.inspect}, remark: #{@remark.inspect},"\
456
+ " add_on_fee: #{@add_on_fee.inspect}, invoice_reference_id:"\
457
+ " #{@invoice_reference_id.inspect}, credit: #{@credit.inspect}, credit_reference_id:"\
458
+ " #{@credit_reference_id.inspect}, home_charging_compensation:"\
459
+ " #{@home_charging_compensation.inspect}, last_updated: #{@last_updated.inspect}>"
460
+ end
461
+ end
462
+ end