digital-payments-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -20
  3. data/lib/{shell_ev → shell_smart_pay_api}/api_helper.rb +2 -2
  4. data/lib/{shell_ev → shell_smart_pay_api}/client.rb +4 -4
  5. data/lib/{shell_ev → shell_smart_pay_api}/configuration.rb +11 -8
  6. data/lib/{shell_ev → shell_smart_pay_api}/controllers/base_controller.rb +11 -11
  7. data/lib/shell_smart_pay_api/controllers/digital_payment_enablement_controller.rb +57 -0
  8. data/lib/{shell_ev → shell_smart_pay_api}/controllers/fueling_controller.rb +50 -49
  9. data/lib/{shell_ev → shell_smart_pay_api}/controllers/partner_notification_controller.rb +27 -27
  10. data/lib/{shell_ev → shell_smart_pay_api}/controllers/shell_api_platform_security_authentication_controller.rb +9 -9
  11. data/lib/{shell_ev → shell_smart_pay_api}/controllers/station_locator_controller.rb +22 -22
  12. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/access_token_error_exception.rb +28 -16
  13. data/lib/shell_smart_pay_api/exceptions/api_exception.rb +21 -0
  14. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/cancel_fueling_error_response_error_exception.rb +31 -17
  15. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/mpp_acces_token_error_response_exception.rb +31 -17
  16. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/payment_enablement_error_response_exception.rb +28 -16
  17. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/station_locator_bad_request_exception.rb +30 -17
  18. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/station_locator_forbidden_exception.rb +30 -17
  19. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/station_locator_internal_server_error_exception.rb +30 -17
  20. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/station_locator_not_found_exception.rb +30 -17
  21. data/lib/{shell_ev → shell_smart_pay_api}/exceptions/station_locator_unauthorized_exception.rb +30 -17
  22. data/lib/{shell_ev → shell_smart_pay_api}/http/auth/mpp_token.rb +2 -2
  23. data/lib/{shell_ev → shell_smart_pay_api}/http/auth/o_auth_token_post.rb +2 -2
  24. data/lib/{shell_ev → shell_smart_pay_api}/http/http_call_back.rb +2 -2
  25. data/lib/{shell_ev → shell_smart_pay_api}/http/http_method_enum.rb +2 -2
  26. data/lib/{shell_ev → shell_smart_pay_api}/http/http_request.rb +2 -2
  27. data/lib/{shell_ev → shell_smart_pay_api}/http/http_response.rb +2 -2
  28. data/lib/{shell_ev → shell_smart_pay_api}/models/access_token_response.rb +17 -4
  29. data/lib/{shell_ev → shell_smart_pay_api}/models/around_location_array.rb +16 -4
  30. data/lib/shell_smart_pay_api/models/base_model.rb +110 -0
  31. data/lib/{shell_ev → shell_smart_pay_api}/models/cancel_fueling_error_response.rb +17 -5
  32. data/lib/{shell_ev → shell_smart_pay_api}/models/cancel_fueling_request.rb +16 -4
  33. data/lib/{shell_ev → shell_smart_pay_api}/models/collecting_company.rb +14 -2
  34. data/lib/{shell_ev/models/around_location_array_data_items.rb → shell_smart_pay_api/models/datum.rb} +78 -57
  35. data/lib/{shell_ev/models/fault_response_fault_detail.rb → shell_smart_pay_api/models/detail.rb} +17 -5
  36. data/lib/{shell_ev/models/prepare_fueling_request_device_details_items.rb → shell_smart_pay_api/models/device_detail.rb} +23 -11
  37. data/lib/{shell_ev/models/fault_response_fault.rb → shell_smart_pay_api/models/fault.rb} +21 -10
  38. data/lib/{shell_ev → shell_smart_pay_api}/models/fault_response.rb +16 -4
  39. data/lib/{shell_ev → shell_smart_pay_api}/models/finalise_fueling_request.rb +31 -18
  40. data/lib/{shell_ev/models/around_location_array_data_items_loc.rb → shell_smart_pay_api/models/loc.rb} +25 -15
  41. data/lib/{shell_ev → shell_smart_pay_api}/models/loyalty_details.rb +16 -4
  42. data/lib/{shell_ev → shell_smart_pay_api}/models/mobile_payment_registration_request.rb +22 -10
  43. data/lib/{shell_ev → shell_smart_pay_api}/models/mpp_acces_token_response.rb +18 -6
  44. data/lib/{shell_ev → shell_smart_pay_api}/models/mpp_error.rb +18 -7
  45. data/lib/{shell_ev/models/around_location_array_data_items_opening_hours_items.rb → shell_smart_pay_api/models/opening_hour.rb} +40 -24
  46. data/lib/{shell_ev/models/finalise_fueling_request_payment.rb → shell_smart_pay_api/models/payment.rb} +22 -10
  47. data/lib/{shell_ev/models/payment_details_items.rb → shell_smart_pay_api/models/payment_details.rb} +22 -9
  48. data/lib/{shell_ev → shell_smart_pay_api}/models/payment_enablement_response.rb +14 -2
  49. data/lib/{shell_ev → shell_smart_pay_api}/models/payment_properties.rb +24 -10
  50. data/lib/{shell_ev → shell_smart_pay_api}/models/prepare_fueling_request.rb +31 -24
  51. data/lib/{shell_ev → shell_smart_pay_api}/models/prepare_fueling_response.rb +16 -4
  52. data/lib/{shell_ev/models/finalise_fueling_request_products_items.rb → shell_smart_pay_api/models/product.rb} +22 -10
  53. data/lib/{shell_ev → shell_smart_pay_api}/utilities/date_time_helper.rb +2 -2
  54. data/lib/shell_smart_pay_api/utilities/file_wrapper.rb +28 -0
  55. data/lib/shell_smart_pay_api.rb +89 -0
  56. data/test/controllers/controller_test_base.rb +3 -3
  57. data/test/controllers/test_fueling_controller.rb +1 -1
  58. data/test/controllers/test_partner_notification_controller.rb +1 -1
  59. data/test/controllers/test_shell_api_platform_security_authentication_controller.rb +1 -1
  60. data/test/controllers/test_station_locator_controller.rb +1 -1
  61. data/test/http_response_catcher.rb +2 -2
  62. metadata +63 -72
  63. data/lib/shell_ev/controllers/digital_payment_enablement_controller.rb +0 -56
  64. data/lib/shell_ev/exceptions/api_exception.rb +0 -10
  65. data/lib/shell_ev/models/base_model.rb +0 -62
  66. data/lib/shell_ev/models/mpp_token_request_body.rb +0 -73
  67. data/lib/shell_ev/models/oauth_token_post_request_body.rb +0 -73
  68. data/lib/shell_ev/models/partner_token_request_body.rb +0 -73
  69. data/lib/shell_ev/utilities/file_wrapper.rb +0 -16
  70. data/lib/shell_ev.rb +0 -85
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # StationLocatorUnauthorized class.
8
8
  class StationLocatorUnauthorizedException < APIException
9
9
  SKIP = Object.new
@@ -15,24 +15,37 @@ module ShellEv
15
15
 
16
16
  # TODO: Write general description for this method
17
17
  # @return [String]
18
- attr_accessor :error_description
19
-
20
- # The constructor.
21
- # @param [String] The reason for raising an exception.
22
- # @param [HttpResponse] The HttpReponse of the API call.
23
- def initialize(reason, response)
24
- super(reason, response)
25
- hash = APIHelper.json_deserialize(@response.raw_body)
26
- unbox(hash)
27
- end
28
-
29
- # Populates this object by extracting properties from a hash.
30
- # @param [Hash] The deserialized response sent by the server in the
31
- # response body.
32
- def unbox(hash)
18
+ attr_accessor :error_description
19
+
20
+ # The constructor.
21
+ # @param [String] The reason for raising an exception.
22
+ # @param [HttpResponse] The HttpReponse of the API call.
23
+ def initialize(reason, response)
24
+ super(reason, response)
25
+ hash = APIHelper.json_deserialize(@response.raw_body)
26
+ unbox(hash)
27
+ end
28
+
29
+ # Populates this object by extracting properties from a hash.
30
+ # @param [Hash] The deserialized response sent by the server in the
31
+ # response body.
32
+ def unbox(hash)
33
33
  @error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP
34
34
  @error_description =
35
35
  hash.key?('errorDescription') ? hash['errorDescription'] : SKIP
36
36
  end
37
+
38
+ # Provides a human-readable string representation of the object.
39
+ def to_s
40
+ class_name = self.class.name.split('::').last
41
+ "<#{class_name} error_code: #{@error_code}, error_description: #{@error_description}>"
42
+ end
43
+
44
+ # Provides a debugging-friendly string with detailed object information.
45
+ def inspect
46
+ class_name = self.class.name.split('::').last
47
+ "<#{class_name} error_code: #{@error_code.inspect}, error_description:"\
48
+ " #{@error_description.inspect}>"
49
+ end
37
50
  end
38
51
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # Utility class for custom header authorization.
8
8
  class MppToken < CoreLibrary::HeaderAuth
9
9
  # Display error message on occurrence of authentication failure.
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # Utility class for custom header authorization.
8
8
  class OAuthTokenPost < CoreLibrary::HeaderAuth
9
9
  # Display error message on occurrence of authentication failure.
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # HttpCallBack allows defining callables for pre and post API calls.
8
8
  class HttpCallBack < CoreLibrary::HttpCallback
9
9
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # HTTP Methods Enumeration.
8
8
  class HttpMethodEnum < CoreLibrary::HttpMethod
9
9
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # Represents a single Http Request.
8
8
  class HttpRequest < CoreLibrary::HttpRequest
9
9
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # Http response received.
8
8
  class HttpResponse < CoreLibrary::HttpResponse
9
9
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # AccessTokenResponse Model.
8
8
  class AccessTokenResponse < BaseModel
9
9
  SKIP = Object.new
@@ -45,8 +45,7 @@ module ShellEv
45
45
  []
46
46
  end
47
47
 
48
- def initialize(access_token = SKIP,
49
- expires_in = SKIP,
48
+ def initialize(access_token = SKIP, expires_in = SKIP,
50
49
  token_type = 'Bearer')
51
50
  @access_token = access_token unless access_token == SKIP
52
51
  @expires_in = expires_in unless expires_in == SKIP
@@ -67,5 +66,19 @@ module ShellEv
67
66
  expires_in,
68
67
  token_type)
69
68
  end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} access_token: #{@access_token}, expires_in: #{@expires_in}, token_type:"\
74
+ " #{@token_type}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} access_token: #{@access_token.inspect}, expires_in: #{@expires_in.inspect},"\
81
+ " token_type: #{@token_type.inspect}>"
82
+ end
70
83
  end
71
84
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # #Amenities The table below lists all the different types of amenities: |
8
8
  # Code | Description | ------- | --------
9
9
  # | 1 | ATM
@@ -62,7 +62,7 @@ module ShellEv
62
62
  private_constant :SKIP
63
63
 
64
64
  # An array of station objects
65
- # @return [Array[AroundLocationArrayDataItems]]
65
+ # @return [Array[Datum]]
66
66
  attr_accessor :data
67
67
 
68
68
  # A mapping from model property names to API property names.
@@ -96,7 +96,7 @@ module ShellEv
96
96
  unless hash['data'].nil?
97
97
  data = []
98
98
  hash['data'].each do |structure|
99
- data << (AroundLocationArrayDataItems.from_hash(structure) if structure)
99
+ data << (Datum.from_hash(structure) if structure)
100
100
  end
101
101
  end
102
102
 
@@ -105,5 +105,17 @@ module ShellEv
105
105
  # Create object from extracted values.
106
106
  AroundLocationArray.new(data)
107
107
  end
108
+
109
+ # Provides a human-readable string representation of the object.
110
+ def to_s
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} data: #{@data}>"
113
+ end
114
+
115
+ # Provides a debugging-friendly string with detailed object information.
116
+ def inspect
117
+ class_name = self.class.name.split('::').last
118
+ "<#{class_name} data: #{@data.inspect}>"
119
+ end
108
120
  end
109
121
  end
@@ -0,0 +1,110 @@
1
+ # shell_smart_pay_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ShellSmartPayApi
7
+ # Base model.
8
+ # rubocop:disable all
9
+ class BaseModel < CoreLibrary::BaseModel
10
+ # Returns a Hash representation of the current object.
11
+ def to_hash
12
+ # validating the model being serialized
13
+ self.class.validate(self) if self.class.respond_to?(:validate)
14
+
15
+ hash = {}
16
+ instance_variables.each do |name|
17
+ value = instance_variable_get(name)
18
+ name = name[1..]
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
33
+ end
34
+
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
53
+ else
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ hash
60
+ end
61
+
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
103
+ # Returns a JSON representation of the curent object.
104
+ def to_json(options = {})
105
+ hash = to_hash
106
+ hash.to_json(options)
107
+ end
108
+ end
109
+ # rubocop:enable all
110
+ end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # # Digital Payments – Errors This section details the structure of the
8
8
  # response Body vs. the different types of errors that could be returned when
9
9
  # Digital Payments system responds with a 400 Response Code. | Error Code
@@ -56,9 +56,7 @@ module ShellEv
56
56
  []
57
57
  end
58
58
 
59
- def initialize(error_code = SKIP,
60
- error_description = SKIP,
61
- errors = SKIP)
59
+ def initialize(error_code = SKIP, error_description = SKIP, errors = SKIP)
62
60
  @error_code = error_code unless error_code == SKIP
63
61
  @error_description = error_description unless error_description == SKIP
64
62
  @errors = errors unless errors == SKIP
@@ -88,5 +86,19 @@ module ShellEv
88
86
  error_description,
89
87
  errors)
90
88
  end
89
+
90
+ # Provides a human-readable string representation of the object.
91
+ def to_s
92
+ class_name = self.class.name.split('::').last
93
+ "<#{class_name} error_code: #{@error_code}, error_description: #{@error_description},"\
94
+ " errors: #{@errors}>"
95
+ end
96
+
97
+ # Provides a debugging-friendly string with detailed object information.
98
+ def inspect
99
+ class_name = self.class.name.split('::').last
100
+ "<#{class_name} error_code: #{@error_code.inspect}, error_description:"\
101
+ " #{@error_description.inspect}, errors: #{@errors.inspect}>"
102
+ end
91
103
  end
92
104
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # CancelFuelingRequest Model.
8
8
  class CancelFuelingRequest < BaseModel
9
9
  SKIP = Object.new
@@ -38,8 +38,7 @@ module ShellEv
38
38
  []
39
39
  end
40
40
 
41
- def initialize(mpp_transaction_id = SKIP,
42
- reason_code = SKIP)
41
+ def initialize(mpp_transaction_id = SKIP, reason_code = SKIP)
43
42
  @mpp_transaction_id = mpp_transaction_id unless mpp_transaction_id == SKIP
44
43
  @reason_code = reason_code unless reason_code == SKIP
45
44
  end
@@ -57,5 +56,18 @@ module ShellEv
57
56
  CancelFuelingRequest.new(mpp_transaction_id,
58
57
  reason_code)
59
58
  end
59
+
60
+ # Provides a human-readable string representation of the object.
61
+ def to_s
62
+ class_name = self.class.name.split('::').last
63
+ "<#{class_name} mpp_transaction_id: #{@mpp_transaction_id}, reason_code: #{@reason_code}>"
64
+ end
65
+
66
+ # Provides a debugging-friendly string with detailed object information.
67
+ def inspect
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} mpp_transaction_id: #{@mpp_transaction_id.inspect}, reason_code:"\
70
+ " #{@reason_code.inspect}>"
71
+ end
60
72
  end
61
73
  end
@@ -1,9 +1,9 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
6
+ module ShellSmartPayApi
7
7
  # CollectingCompany Model.
8
8
  class CollectingCompany < BaseModel
9
9
  SKIP = Object.new
@@ -46,5 +46,17 @@ module ShellEv
46
46
  # Create object from extracted values.
47
47
  CollectingCompany.new(col_co_id)
48
48
  end
49
+
50
+ # Provides a human-readable string representation of the object.
51
+ def to_s
52
+ class_name = self.class.name.split('::').last
53
+ "<#{class_name} col_co_id: #{@col_co_id}>"
54
+ end
55
+
56
+ # Provides a debugging-friendly string with detailed object information.
57
+ def inspect
58
+ class_name = self.class.name.split('::').last
59
+ "<#{class_name} col_co_id: #{@col_co_id.inspect}>"
60
+ end
49
61
  end
50
62
  end
@@ -1,11 +1,11 @@
1
- # shell_ev
1
+ # shell_smart_pay_api
2
2
  #
3
3
  # This file was automatically generated by APIMATIC v2.0
4
4
  # ( https://apimatic.io ).
5
5
 
6
- module ShellEv
7
- # AroundLocationArrayDataItems Model.
8
- class AroundLocationArrayDataItems < BaseModel
6
+ module ShellSmartPayApi
7
+ # Datum Model.
8
+ class Datum < BaseModel
9
9
  SKIP = Object.new
10
10
  private_constant :SKIP
11
11
 
@@ -77,7 +77,7 @@ module ShellEv
77
77
  attr_accessor :fuel
78
78
 
79
79
  # Object containing address details/elements
80
- # @return [AroundLocationArrayDataItemsLoc]
80
+ # @return [Loc]
81
81
  attr_accessor :loc
82
82
 
83
83
  # This is the 5-digit Shell Station ID. Leading ‘0’ should be dropped and
@@ -104,7 +104,7 @@ module ShellEv
104
104
 
105
105
  # An Array of the station’s opening hours. This may have opening and closing
106
106
  # times in hours, minutes and the day of the week.
107
- # @return [Array[AroundLocationArrayDataItemsOpeningHoursItems]]
107
+ # @return [Array[OpeningHour]]
108
108
  attr_accessor :opening_hours
109
109
 
110
110
  # Station’s contact telephone number
@@ -143,6 +143,16 @@ module ShellEv
143
143
  # An array for optional fields
144
144
  def self.optionals
145
145
  %w[
146
+ id
147
+ type
148
+ name
149
+ addr
150
+ lat
151
+ lon
152
+ amen
153
+ fuel
154
+ loc
155
+ mpp_station_id
146
156
  double_site_id
147
157
  opening_hours
148
158
  telephone
@@ -156,31 +166,21 @@ module ShellEv
156
166
  []
157
167
  end
158
168
 
159
- def initialize(id = nil,
160
- type = nil,
161
- name = nil,
162
- addr = nil,
163
- lat = nil,
164
- lon = nil,
165
- amen = nil,
166
- fuel = nil,
167
- loc = nil,
168
- mpp_station_id = nil,
169
- double_site_id = SKIP,
170
- opening_hours = SKIP,
171
- telephone = SKIP,
172
- authorisation_code = SKIP,
173
- mp_preauth = SKIP)
174
- @id = id
175
- @type = type
176
- @name = name
177
- @addr = addr
178
- @lat = lat
179
- @lon = lon
180
- @amen = amen
181
- @fuel = fuel
182
- @loc = loc
183
- @mpp_station_id = mpp_station_id
169
+ def initialize(id = SKIP, type = SKIP, name = SKIP, addr = SKIP, lat = SKIP,
170
+ lon = SKIP, amen = SKIP, fuel = SKIP, loc = SKIP,
171
+ mpp_station_id = SKIP, double_site_id = SKIP,
172
+ opening_hours = SKIP, telephone = SKIP,
173
+ authorisation_code = SKIP, mp_preauth = SKIP)
174
+ @id = id unless id == SKIP
175
+ @type = type unless type == SKIP
176
+ @name = name unless name == SKIP
177
+ @addr = addr unless addr == SKIP
178
+ @lat = lat unless lat == SKIP
179
+ @lon = lon unless lon == SKIP
180
+ @amen = amen unless amen == SKIP
181
+ @fuel = fuel unless fuel == SKIP
182
+ @loc = loc unless loc == SKIP
183
+ @mpp_station_id = mpp_station_id unless mpp_station_id == SKIP
184
184
  @double_site_id = double_site_id unless double_site_id == SKIP
185
185
  @opening_hours = opening_hours unless opening_hours == SKIP
186
186
  @telephone = telephone unless telephone == SKIP
@@ -193,17 +193,17 @@ module ShellEv
193
193
  return nil unless hash
194
194
 
195
195
  # Extract variables from the hash.
196
- id = hash.key?('id') ? hash['id'] : nil
197
- type = hash.key?('type') ? hash['type'] : nil
198
- name = hash.key?('name') ? hash['name'] : nil
199
- addr = hash.key?('addr') ? hash['addr'] : nil
200
- lat = hash.key?('lat') ? hash['lat'] : nil
201
- lon = hash.key?('lon') ? hash['lon'] : nil
202
- amen = hash.key?('amen') ? hash['amen'] : nil
203
- fuel = hash.key?('fuel') ? hash['fuel'] : nil
204
- loc = AroundLocationArrayDataItemsLoc.from_hash(hash['loc']) if hash['loc']
196
+ id = hash.key?('id') ? hash['id'] : SKIP
197
+ type = hash.key?('type') ? hash['type'] : SKIP
198
+ name = hash.key?('name') ? hash['name'] : SKIP
199
+ addr = hash.key?('addr') ? hash['addr'] : SKIP
200
+ lat = hash.key?('lat') ? hash['lat'] : SKIP
201
+ lon = hash.key?('lon') ? hash['lon'] : SKIP
202
+ amen = hash.key?('amen') ? hash['amen'] : SKIP
203
+ fuel = hash.key?('fuel') ? hash['fuel'] : SKIP
204
+ loc = Loc.from_hash(hash['loc']) if hash['loc']
205
205
  mpp_station_id =
206
- hash.key?('mpp_station_id') ? hash['mpp_station_id'] : nil
206
+ hash.key?('mpp_station_id') ? hash['mpp_station_id'] : SKIP
207
207
  double_site_id =
208
208
  hash.key?('double_site_id') ? hash['double_site_id'] : SKIP
209
209
  # Parameter is an array, so we need to iterate through it
@@ -211,7 +211,7 @@ module ShellEv
211
211
  unless hash['opening_hours'].nil?
212
212
  opening_hours = []
213
213
  hash['opening_hours'].each do |structure|
214
- opening_hours << (AroundLocationArrayDataItemsOpeningHoursItems.from_hash(structure) if structure)
214
+ opening_hours << (OpeningHour.from_hash(structure) if structure)
215
215
  end
216
216
  end
217
217
 
@@ -222,21 +222,42 @@ module ShellEv
222
222
  mp_preauth = hash.key?('mp_preauth') ? hash['mp_preauth'] : SKIP
223
223
 
224
224
  # Create object from extracted values.
225
- AroundLocationArrayDataItems.new(id,
226
- type,
227
- name,
228
- addr,
229
- lat,
230
- lon,
231
- amen,
232
- fuel,
233
- loc,
234
- mpp_station_id,
235
- double_site_id,
236
- opening_hours,
237
- telephone,
238
- authorisation_code,
239
- mp_preauth)
225
+ Datum.new(id,
226
+ type,
227
+ name,
228
+ addr,
229
+ lat,
230
+ lon,
231
+ amen,
232
+ fuel,
233
+ loc,
234
+ mpp_station_id,
235
+ double_site_id,
236
+ opening_hours,
237
+ telephone,
238
+ authorisation_code,
239
+ mp_preauth)
240
+ end
241
+
242
+ # Provides a human-readable string representation of the object.
243
+ def to_s
244
+ class_name = self.class.name.split('::').last
245
+ "<#{class_name} id: #{@id}, type: #{@type}, name: #{@name}, addr: #{@addr}, lat: #{@lat},"\
246
+ " lon: #{@lon}, amen: #{@amen}, fuel: #{@fuel}, loc: #{@loc}, mpp_station_id:"\
247
+ " #{@mpp_station_id}, double_site_id: #{@double_site_id}, opening_hours: #{@opening_hours},"\
248
+ " telephone: #{@telephone}, authorisation_code: #{@authorisation_code}, mp_preauth:"\
249
+ " #{@mp_preauth}>"
250
+ end
251
+
252
+ # Provides a debugging-friendly string with detailed object information.
253
+ def inspect
254
+ class_name = self.class.name.split('::').last
255
+ "<#{class_name} id: #{@id.inspect}, type: #{@type.inspect}, name: #{@name.inspect}, addr:"\
256
+ " #{@addr.inspect}, lat: #{@lat.inspect}, lon: #{@lon.inspect}, amen: #{@amen.inspect},"\
257
+ " fuel: #{@fuel.inspect}, loc: #{@loc.inspect}, mpp_station_id: #{@mpp_station_id.inspect},"\
258
+ " double_site_id: #{@double_site_id.inspect}, opening_hours: #{@opening_hours.inspect},"\
259
+ " telephone: #{@telephone.inspect}, authorisation_code: #{@authorisation_code.inspect},"\
260
+ " mp_preauth: #{@mp_preauth.inspect}>"
240
261
  end
241
262
  end
242
263
  end