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,114 @@
1
+ # e_mobility_vmspocpiap_is
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module EMobilityVmspocpiapIs
7
+ # This class references an image related to an EVSE in terms of a file name or
8
+ # url. Per charge point an unlimited number of images of each type is allowed.
9
+ # Recommended are at least two images where one is a network or provider logo
10
+ # and the second is a station photo.
11
+ class Image < BaseModel
12
+ SKIP = Object.new
13
+ private_constant :SKIP
14
+
15
+ # URL from where the image data can be fetched through a web browser.
16
+ # @return [String]
17
+ attr_accessor :url
18
+
19
+ # URL from where a thumbnail of the image can be fetched through a web
20
+ # browser.
21
+ # @return [String]
22
+ attr_accessor :thumbnail
23
+
24
+ # The category of an image to obtain the correct usage in a user
25
+ # presentation. The category has to be set accordingly to the image content
26
+ # in order to guarantee the right usage.
27
+ # @return [ImageCategoryEnum]
28
+ attr_accessor :category
29
+
30
+ # Image type like: gif, jpeg, png, svg.
31
+ # @return [String]
32
+ attr_accessor :type
33
+
34
+ # Width of the full scale image.
35
+ # @return [Integer]
36
+ attr_accessor :width
37
+
38
+ # Height of the full scale image.
39
+ # @return [Integer]
40
+ attr_accessor :height
41
+
42
+ # A mapping from model property names to API property names.
43
+ def self.names
44
+ @_hash = {} if @_hash.nil?
45
+ @_hash['url'] = 'url'
46
+ @_hash['thumbnail'] = 'thumbnail'
47
+ @_hash['category'] = 'category'
48
+ @_hash['type'] = 'type'
49
+ @_hash['width'] = 'width'
50
+ @_hash['height'] = 'height'
51
+ @_hash
52
+ end
53
+
54
+ # An array for optional fields
55
+ def self.optionals
56
+ %w[
57
+ thumbnail
58
+ width
59
+ height
60
+ ]
61
+ end
62
+
63
+ # An array for nullable fields
64
+ def self.nullables
65
+ []
66
+ end
67
+
68
+ def initialize(url = nil, category = nil, type = nil, thumbnail = SKIP,
69
+ width = SKIP, height = SKIP)
70
+ @url = url
71
+ @thumbnail = thumbnail unless thumbnail == SKIP
72
+ @category = category
73
+ @type = type
74
+ @width = width unless width == SKIP
75
+ @height = height unless height == SKIP
76
+ end
77
+
78
+ # Creates an instance of the object from a hash.
79
+ def self.from_hash(hash)
80
+ return nil unless hash
81
+
82
+ # Extract variables from the hash.
83
+ url = hash.key?('url') ? hash['url'] : nil
84
+ category = hash.key?('category') ? hash['category'] : nil
85
+ type = hash.key?('type') ? hash['type'] : nil
86
+ thumbnail = hash.key?('thumbnail') ? hash['thumbnail'] : SKIP
87
+ width = hash.key?('width') ? hash['width'] : SKIP
88
+ height = hash.key?('height') ? hash['height'] : SKIP
89
+
90
+ # Create object from extracted values.
91
+ Image.new(url,
92
+ category,
93
+ type,
94
+ thumbnail,
95
+ width,
96
+ height)
97
+ end
98
+
99
+ # Provides a human-readable string representation of the object.
100
+ def to_s
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} url: #{@url}, thumbnail: #{@thumbnail}, category: #{@category}, type:"\
103
+ " #{@type}, width: #{@width}, height: #{@height}>"
104
+ end
105
+
106
+ # Provides a debugging-friendly string with detailed object information.
107
+ def inspect
108
+ class_name = self.class.name.split('::').last
109
+ "<#{class_name} url: #{@url.inspect}, thumbnail: #{@thumbnail.inspect}, category:"\
110
+ " #{@category.inspect}, type: #{@type.inspect}, width: #{@width.inspect}, height:"\
111
+ " #{@height.inspect}>"
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,58 @@
1
+ # e_mobility_vmspocpiap_is
2
+ #
3
+ # This file was automatically generated by
4
+ # APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module EMobilityVmspocpiapIs
7
+ # The category of an image to obtain the correct usage in a user presentation.
8
+ # The category has to be set accordingly to the image content in order to
9
+ # guarantee the right usage.
10
+ class ImageCategoryEnum
11
+ IMAGE_CATEGORY_ENUM = [
12
+ # TODO: Write general description for CHARGER
13
+ CHARGER = 'CHARGER'.freeze,
14
+
15
+ # TODO: Write general description for ENTRANCE
16
+ ENTRANCE = 'ENTRANCE'.freeze,
17
+
18
+ # TODO: Write general description for LOCATION
19
+ LOCATION = 'LOCATION'.freeze,
20
+
21
+ # TODO: Write general description for NETWORK
22
+ NETWORK = 'NETWORK'.freeze,
23
+
24
+ # TODO: Write general description for OPERATOR
25
+ OPERATOR = 'OPERATOR'.freeze,
26
+
27
+ # TODO: Write general description for OTHER
28
+ OTHER = 'OTHER'.freeze,
29
+
30
+ # TODO: Write general description for OWNER
31
+ OWNER = 'OWNER'.freeze
32
+ ].freeze
33
+
34
+ def self.validate(value)
35
+ return false if value.nil?
36
+
37
+ IMAGE_CATEGORY_ENUM.include?(value)
38
+ end
39
+
40
+ def self.from_value(value, default_value = CHARGER)
41
+ return default_value if value.nil?
42
+
43
+ str = value.to_s.strip
44
+
45
+ case str.downcase
46
+ when 'charger' then CHARGER
47
+ when 'entrance' then ENTRANCE
48
+ when 'location' then LOCATION
49
+ when 'network' then NETWORK
50
+ when 'operator' then OPERATOR
51
+ when 'other' then OTHER
52
+ when 'owner' then OWNER
53
+ else
54
+ default_value
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,379 @@
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 Location object describes the location and its properties where a group
9
+ # of EVSEs that belong together are installed. Typically, the Location object
10
+ # is the exact location of the group of EVSEs, but it can also be the entrance
11
+ # of a parking garage which contains these EVSEs. The exact way to reach each
12
+ # EVSE can be further specified by its own properties.
13
+ class Location < BaseModel
14
+ SKIP = Object.new
15
+ private_constant :SKIP
16
+
17
+ # Site accessibility by vehicle or program. This field is specific for Tesla
18
+ # chargers.
19
+ # @return [String]
20
+ attr_accessor :charging_accessibility
21
+
22
+ # ISO-3166 alpha-2 country code of the CPO that 'owns' this Location.
23
+ # @return [String]
24
+ attr_accessor :country_code
25
+
26
+ # ID of the CPO that 'owns' this Location (following the ISO-15118
27
+ # standard).
28
+ # @return [String]
29
+ attr_accessor :party_id
30
+
31
+ # Uniquely identifies the location within the CPOs platform (and suboperator
32
+ # platforms). This field can never be changed, modified or renamed.
33
+ # @return [String]
34
+ attr_accessor :id
35
+
36
+ # Defines if a Location may be published on a website or app etc.
37
+ # When the same location has EVSEs that may be published and may not be
38
+ # published,
39
+ # two 'Locations' should be created.
40
+ # @return [TrueClass | FalseClass]
41
+ attr_accessor :publish
42
+
43
+ # Display name of the location.
44
+ # @return [String]
45
+ attr_accessor :name
46
+
47
+ # Street/block name and house number if available.
48
+ # @return [String]
49
+ attr_accessor :address
50
+
51
+ # City or town.
52
+ # @return [String]
53
+ attr_accessor :city
54
+
55
+ # Postal code of the location, may only be omitted when the location has no
56
+ # postal code.
57
+ # @return [String]
58
+ attr_accessor :postal_code
59
+
60
+ # State or province of the location, only to be used when relevant.
61
+ # @return [String]
62
+ attr_accessor :state
63
+
64
+ # Province of the location, only to be used when relevant.
65
+ # @return [String]
66
+ attr_accessor :province
67
+
68
+ # ISO 3166-1 alpha-3 code for the country of this location.
69
+ # @return [String]
70
+ attr_accessor :country
71
+
72
+ # This class defines the geo location of the Charge Point. The geodetic
73
+ # system to be used is WGS 84.
74
+ # Five decimal places is seen as a minimum for GPS coordinates as this gives
75
+ # approximately 1 meter precision.
76
+ # More is always better. Seven decimal places gives approximately 1cm
77
+ # precision.
78
+ # @return [GeoLocation]
79
+ attr_accessor :coordinates
80
+
81
+ # Geographical location of related points relevant to the user.
82
+ # @return [Array[AdditionalGeoLocation]]
83
+ attr_accessor :related_locations
84
+
85
+ # Reflects the general type of the charge point's location. May be used for
86
+ # user information.
87
+ # @return [ParkingTypeEnum]
88
+ attr_accessor :parking_type
89
+
90
+ # List of EVSEs that belong to this Location.
91
+ # @return [Array[EVSE]]
92
+ attr_accessor :evses
93
+
94
+ # Phone number for help or support at the location. New in OCPI 2.3.0.
95
+ # @return [String]
96
+ attr_accessor :help_phone
97
+
98
+ # Human-readable directions on how to reach the location.
99
+ # @return [Array[DisplayText]]
100
+ attr_accessor :directions
101
+
102
+ # Business details of an operator, suboperator, or owner.
103
+ # @return [BusinessDetails]
104
+ attr_accessor :operator
105
+
106
+ # Business details of an operator, suboperator, or owner.
107
+ # @return [BusinessDetails]
108
+ attr_accessor :suboperator
109
+
110
+ # Business details of an operator, suboperator, or owner.
111
+ # @return [BusinessDetails]
112
+ attr_accessor :owner
113
+
114
+ # Optional list of facilities this charging location directly belongs to.
115
+ # @return [Array[FacilityEnum]]
116
+ attr_accessor :facilities
117
+
118
+ # One of IANA tzdata's TZ-values representing the time zone of the location.
119
+ # Examples "Europe/Oslo", "Europe/Zurich".
120
+ # @return [String]
121
+ attr_accessor :time_zone
122
+
123
+ # Opening and access hours of the location.
124
+ # @return [Hours]
125
+ attr_accessor :opening_times
126
+
127
+ # Indicates if the EVSEs are still charging outside the opening hours of the
128
+ # location. Default is true.
129
+ # @return [TrueClass | FalseClass]
130
+ attr_accessor :charging_when_closed
131
+
132
+ # Links to images related to the location such as photos or logos.
133
+ # @return [Array[Image]]
134
+ attr_accessor :images
135
+
136
+ # Timestamp when this Location or one of its EVSEs or Connectors were last
137
+ # updated (or created).
138
+ # @return [DateTime]
139
+ attr_accessor :last_updated
140
+
141
+ # A mapping from model property names to API property names.
142
+ def self.names
143
+ @_hash = {} if @_hash.nil?
144
+ @_hash['charging_accessibility'] = 'charging_accessibility'
145
+ @_hash['country_code'] = 'country_code'
146
+ @_hash['party_id'] = 'party_id'
147
+ @_hash['id'] = 'id'
148
+ @_hash['publish'] = 'publish'
149
+ @_hash['name'] = 'name'
150
+ @_hash['address'] = 'address'
151
+ @_hash['city'] = 'city'
152
+ @_hash['postal_code'] = 'postal_code'
153
+ @_hash['state'] = 'state'
154
+ @_hash['province'] = 'province'
155
+ @_hash['country'] = 'country'
156
+ @_hash['coordinates'] = 'coordinates'
157
+ @_hash['related_locations'] = 'related_locations'
158
+ @_hash['parking_type'] = 'parking_type'
159
+ @_hash['evses'] = 'evses'
160
+ @_hash['help_phone'] = 'help_phone'
161
+ @_hash['directions'] = 'directions'
162
+ @_hash['operator'] = 'operator'
163
+ @_hash['suboperator'] = 'suboperator'
164
+ @_hash['owner'] = 'owner'
165
+ @_hash['facilities'] = 'facilities'
166
+ @_hash['time_zone'] = 'time_zone'
167
+ @_hash['opening_times'] = 'opening_times'
168
+ @_hash['charging_when_closed'] = 'charging_when_closed'
169
+ @_hash['images'] = 'images'
170
+ @_hash['last_updated'] = 'last_updated'
171
+ @_hash
172
+ end
173
+
174
+ # An array for optional fields
175
+ def self.optionals
176
+ %w[
177
+ charging_accessibility
178
+ name
179
+ postal_code
180
+ state
181
+ province
182
+ related_locations
183
+ parking_type
184
+ evses
185
+ help_phone
186
+ directions
187
+ operator
188
+ suboperator
189
+ owner
190
+ facilities
191
+ opening_times
192
+ charging_when_closed
193
+ images
194
+ ]
195
+ end
196
+
197
+ # An array for nullable fields
198
+ def self.nullables
199
+ []
200
+ end
201
+
202
+ def initialize(country_code = nil, party_id = nil, id = nil, publish = nil,
203
+ address = nil, city = nil, country = nil, coordinates = nil,
204
+ time_zone = nil, last_updated = nil,
205
+ charging_accessibility = SKIP, name = SKIP,
206
+ postal_code = SKIP, state = SKIP, province = SKIP,
207
+ related_locations = SKIP, parking_type = SKIP, evses = SKIP,
208
+ help_phone = SKIP, directions = SKIP, operator = SKIP,
209
+ suboperator = SKIP, owner = SKIP, facilities = SKIP,
210
+ opening_times = SKIP, charging_when_closed = SKIP,
211
+ images = SKIP)
212
+ @charging_accessibility = charging_accessibility unless charging_accessibility == SKIP
213
+ @country_code = country_code
214
+ @party_id = party_id
215
+ @id = id
216
+ @publish = publish
217
+ @name = name unless name == SKIP
218
+ @address = address
219
+ @city = city
220
+ @postal_code = postal_code unless postal_code == SKIP
221
+ @state = state unless state == SKIP
222
+ @province = province unless province == SKIP
223
+ @country = country
224
+ @coordinates = coordinates
225
+ @related_locations = related_locations unless related_locations == SKIP
226
+ @parking_type = parking_type unless parking_type == SKIP
227
+ @evses = evses unless evses == SKIP
228
+ @help_phone = help_phone unless help_phone == SKIP
229
+ @directions = directions unless directions == SKIP
230
+ @operator = operator unless operator == SKIP
231
+ @suboperator = suboperator unless suboperator == SKIP
232
+ @owner = owner unless owner == SKIP
233
+ @facilities = facilities unless facilities == SKIP
234
+ @time_zone = time_zone
235
+ @opening_times = opening_times unless opening_times == SKIP
236
+ @charging_when_closed = charging_when_closed unless charging_when_closed == SKIP
237
+ @images = images unless images == SKIP
238
+ @last_updated = last_updated
239
+ end
240
+
241
+ # Creates an instance of the object from a hash.
242
+ def self.from_hash(hash)
243
+ return nil unless hash
244
+
245
+ # Extract variables from the hash.
246
+ country_code = hash.key?('country_code') ? hash['country_code'] : nil
247
+ party_id = hash.key?('party_id') ? hash['party_id'] : nil
248
+ id = hash.key?('id') ? hash['id'] : nil
249
+ publish = hash.key?('publish') ? hash['publish'] : nil
250
+ address = hash.key?('address') ? hash['address'] : nil
251
+ city = hash.key?('city') ? hash['city'] : nil
252
+ country = hash.key?('country') ? hash['country'] : nil
253
+ coordinates = GeoLocation.from_hash(hash['coordinates']) if hash['coordinates']
254
+ time_zone = hash.key?('time_zone') ? hash['time_zone'] : nil
255
+ last_updated = if hash.key?('last_updated')
256
+ (DateTimeHelper.from_rfc3339(hash['last_updated']) if hash['last_updated'])
257
+ end
258
+ charging_accessibility =
259
+ hash.key?('charging_accessibility') ? hash['charging_accessibility'] : SKIP
260
+ name = hash.key?('name') ? hash['name'] : SKIP
261
+ postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP
262
+ state = hash.key?('state') ? hash['state'] : SKIP
263
+ province = hash.key?('province') ? hash['province'] : SKIP
264
+ # Parameter is an array, so we need to iterate through it
265
+ related_locations = nil
266
+ unless hash['related_locations'].nil?
267
+ related_locations = []
268
+ hash['related_locations'].each do |structure|
269
+ related_locations << (AdditionalGeoLocation.from_hash(structure) if structure)
270
+ end
271
+ end
272
+
273
+ related_locations = SKIP unless hash.key?('related_locations')
274
+ parking_type = hash.key?('parking_type') ? hash['parking_type'] : SKIP
275
+ # Parameter is an array, so we need to iterate through it
276
+ evses = nil
277
+ unless hash['evses'].nil?
278
+ evses = []
279
+ hash['evses'].each do |structure|
280
+ evses << (EVSE.from_hash(structure) if structure)
281
+ end
282
+ end
283
+
284
+ evses = SKIP unless hash.key?('evses')
285
+ help_phone = hash.key?('help_phone') ? hash['help_phone'] : SKIP
286
+ # Parameter is an array, so we need to iterate through it
287
+ directions = nil
288
+ unless hash['directions'].nil?
289
+ directions = []
290
+ hash['directions'].each do |structure|
291
+ directions << (DisplayText.from_hash(structure) if structure)
292
+ end
293
+ end
294
+
295
+ directions = SKIP unless hash.key?('directions')
296
+ operator = BusinessDetails.from_hash(hash['operator']) if hash['operator']
297
+ suboperator = BusinessDetails.from_hash(hash['suboperator']) if hash['suboperator']
298
+ owner = BusinessDetails.from_hash(hash['owner']) if hash['owner']
299
+ facilities = hash.key?('facilities') ? hash['facilities'] : SKIP
300
+ opening_times = Hours.from_hash(hash['opening_times']) if hash['opening_times']
301
+ charging_when_closed =
302
+ hash.key?('charging_when_closed') ? hash['charging_when_closed'] : SKIP
303
+ # Parameter is an array, so we need to iterate through it
304
+ images = nil
305
+ unless hash['images'].nil?
306
+ images = []
307
+ hash['images'].each do |structure|
308
+ images << (Image.from_hash(structure) if structure)
309
+ end
310
+ end
311
+
312
+ images = SKIP unless hash.key?('images')
313
+
314
+ # Create object from extracted values.
315
+ Location.new(country_code,
316
+ party_id,
317
+ id,
318
+ publish,
319
+ address,
320
+ city,
321
+ country,
322
+ coordinates,
323
+ time_zone,
324
+ last_updated,
325
+ charging_accessibility,
326
+ name,
327
+ postal_code,
328
+ state,
329
+ province,
330
+ related_locations,
331
+ parking_type,
332
+ evses,
333
+ help_phone,
334
+ directions,
335
+ operator,
336
+ suboperator,
337
+ owner,
338
+ facilities,
339
+ opening_times,
340
+ charging_when_closed,
341
+ images)
342
+ end
343
+
344
+ def to_custom_last_updated
345
+ DateTimeHelper.to_rfc3339(last_updated)
346
+ end
347
+
348
+ # Provides a human-readable string representation of the object.
349
+ def to_s
350
+ class_name = self.class.name.split('::').last
351
+ "<#{class_name} charging_accessibility: #{@charging_accessibility}, country_code:"\
352
+ " #{@country_code}, party_id: #{@party_id}, id: #{@id}, publish: #{@publish}, name:"\
353
+ " #{@name}, address: #{@address}, city: #{@city}, postal_code: #{@postal_code}, state:"\
354
+ " #{@state}, province: #{@province}, country: #{@country}, coordinates: #{@coordinates},"\
355
+ " related_locations: #{@related_locations}, parking_type: #{@parking_type}, evses:"\
356
+ " #{@evses}, help_phone: #{@help_phone}, directions: #{@directions}, operator: #{@operator},"\
357
+ " suboperator: #{@suboperator}, owner: #{@owner}, facilities: #{@facilities}, time_zone:"\
358
+ " #{@time_zone}, opening_times: #{@opening_times}, charging_when_closed:"\
359
+ " #{@charging_when_closed}, images: #{@images}, last_updated: #{@last_updated}>"
360
+ end
361
+
362
+ # Provides a debugging-friendly string with detailed object information.
363
+ def inspect
364
+ class_name = self.class.name.split('::').last
365
+ "<#{class_name} charging_accessibility: #{@charging_accessibility.inspect}, country_code:"\
366
+ " #{@country_code.inspect}, party_id: #{@party_id.inspect}, id: #{@id.inspect}, publish:"\
367
+ " #{@publish.inspect}, name: #{@name.inspect}, address: #{@address.inspect}, city:"\
368
+ " #{@city.inspect}, postal_code: #{@postal_code.inspect}, state: #{@state.inspect},"\
369
+ " province: #{@province.inspect}, country: #{@country.inspect}, coordinates:"\
370
+ " #{@coordinates.inspect}, related_locations: #{@related_locations.inspect}, parking_type:"\
371
+ " #{@parking_type.inspect}, evses: #{@evses.inspect}, help_phone: #{@help_phone.inspect},"\
372
+ " directions: #{@directions.inspect}, operator: #{@operator.inspect}, suboperator:"\
373
+ " #{@suboperator.inspect}, owner: #{@owner.inspect}, facilities: #{@facilities.inspect},"\
374
+ " time_zone: #{@time_zone.inspect}, opening_times: #{@opening_times.inspect},"\
375
+ " charging_when_closed: #{@charging_when_closed.inspect}, images: #{@images.inspect},"\
376
+ " last_updated: #{@last_updated.inspect}>"
377
+ end
378
+ end
379
+ end