loyalty-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 (104) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +187 -0
  4. data/bin/console +15 -0
  5. data/lib/loyalty_ap_is/api_helper.rb +10 -0
  6. data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
  7. data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
  8. data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
  9. data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
  10. data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
  11. data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
  12. data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
  13. data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
  14. data/lib/loyalty_ap_is/client.rb +137 -0
  15. data/lib/loyalty_ap_is/configuration.rb +238 -0
  16. data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
  17. data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
  18. data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
  19. data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
  20. data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
  21. data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
  22. data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
  23. data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
  24. data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
  25. data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
  26. data/lib/loyalty_ap_is/http/api_response.rb +19 -0
  27. data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
  28. data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
  29. data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
  30. data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
  31. data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
  32. data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
  33. data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
  34. data/lib/loyalty_ap_is/http/http_request.rb +10 -0
  35. data/lib/loyalty_ap_is/http/http_response.rb +10 -0
  36. data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
  37. data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  38. data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
  39. data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
  40. data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
  41. data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
  42. data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
  43. data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
  44. data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
  45. data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
  46. data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
  47. data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
  48. data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
  49. data/lib/loyalty_ap_is/models/base_model.rb +110 -0
  50. data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
  51. data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
  52. data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
  53. data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
  54. data/lib/loyalty_ap_is/models/error_info.rb +84 -0
  55. data/lib/loyalty_ap_is/models/error_item.rb +105 -0
  56. data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
  57. data/lib/loyalty_ap_is/models/error_source.rb +75 -0
  58. data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
  59. data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
  60. data/lib/loyalty_ap_is/models/fault.rb +85 -0
  61. data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
  62. data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
  63. data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
  64. data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
  65. data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
  66. data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
  67. data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
  68. data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
  69. data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
  70. data/lib/loyalty_ap_is/models/offer.rb +155 -0
  71. data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
  72. data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
  73. data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
  74. data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
  75. data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
  76. data/lib/loyalty_ap_is/models/product_type.rb +53 -0
  77. data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
  78. data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
  79. data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
  80. data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
  81. data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
  82. data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
  83. data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
  84. data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
  85. data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
  86. data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
  87. data/lib/loyalty_ap_is/models/site_data.rb +121 -0
  88. data/lib/loyalty_ap_is/models/transaction.rb +351 -0
  89. data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
  90. data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
  91. data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
  92. data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
  93. data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
  94. data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
  95. data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
  96. data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
  97. data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
  98. data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
  99. data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
  100. data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
  101. data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
  102. data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
  103. data/lib/loyalty_ap_is.rb +128 -0
  104. metadata +189 -0
@@ -0,0 +1,151 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module LoyaltyApIs
8
+ # EvChargingDetails Model.
9
+ class EvChargingDetails < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Charging point serial ID
14
+ # @return [String]
15
+ attr_accessor :charge_point_serial_id
16
+
17
+ # Charging point connector type
18
+ # @return [String]
19
+ attr_accessor :charge_point_connector_type_cd
20
+
21
+ # Charging point connector description
22
+ # @return [String]
23
+ attr_accessor :charge_point_connector_type_desc
24
+
25
+ # Date and time at which the transaction started. Format as per ISO 8601
26
+ # standard.
27
+ # @return [DateTime]
28
+ attr_accessor :start_date_time
29
+
30
+ # Date and time at which the transaction ended. Format as per ISO 8601
31
+ # standard.
32
+ # @return [DateTime]
33
+ attr_accessor :end_date_time
34
+
35
+ # Duration of the transaction in seconds.
36
+ # @return [Integer]
37
+ attr_accessor :duration
38
+
39
+ # A mapping from model property names to API property names.
40
+ def self.names
41
+ @_hash = {} if @_hash.nil?
42
+ @_hash['charge_point_serial_id'] = 'chargePointSerialId'
43
+ @_hash['charge_point_connector_type_cd'] = 'chargePointConnectorTypeCd'
44
+ @_hash['charge_point_connector_type_desc'] =
45
+ 'chargePointConnectorTypeDesc'
46
+ @_hash['start_date_time'] = 'startDateTime'
47
+ @_hash['end_date_time'] = 'endDateTime'
48
+ @_hash['duration'] = 'duration'
49
+ @_hash
50
+ end
51
+
52
+ # An array for optional fields
53
+ def self.optionals
54
+ %w[
55
+ charge_point_connector_type_cd
56
+ charge_point_connector_type_desc
57
+ ]
58
+ end
59
+
60
+ # An array for nullable fields
61
+ def self.nullables
62
+ []
63
+ end
64
+
65
+ def initialize(charge_point_serial_id:, start_date_time:, end_date_time:,
66
+ duration: 0, charge_point_connector_type_cd: SKIP,
67
+ charge_point_connector_type_desc: SKIP,
68
+ additional_properties: nil)
69
+ # Add additional model properties to the instance
70
+ additional_properties = {} if additional_properties.nil?
71
+
72
+ @charge_point_serial_id = charge_point_serial_id
73
+ unless charge_point_connector_type_cd == SKIP
74
+ @charge_point_connector_type_cd =
75
+ charge_point_connector_type_cd
76
+ end
77
+ unless charge_point_connector_type_desc == SKIP
78
+ @charge_point_connector_type_desc =
79
+ charge_point_connector_type_desc
80
+ end
81
+ @start_date_time = start_date_time
82
+ @end_date_time = end_date_time
83
+ @duration = duration
84
+ @additional_properties = additional_properties
85
+ end
86
+
87
+ # Creates an instance of the object from a hash.
88
+ def self.from_hash(hash)
89
+ return nil unless hash
90
+
91
+ # Extract variables from the hash.
92
+ charge_point_serial_id =
93
+ hash.key?('chargePointSerialId') ? hash['chargePointSerialId'] : nil
94
+ start_date_time = if hash.key?('startDateTime')
95
+ (DateTimeHelper.from_rfc3339(hash['startDateTime']) if hash['startDateTime'])
96
+ end
97
+ end_date_time = if hash.key?('endDateTime')
98
+ (DateTimeHelper.from_rfc3339(hash['endDateTime']) if hash['endDateTime'])
99
+ end
100
+ duration = hash['duration'] ||= 0
101
+ charge_point_connector_type_cd =
102
+ hash.key?('chargePointConnectorTypeCd') ? hash['chargePointConnectorTypeCd'] : SKIP
103
+ charge_point_connector_type_desc =
104
+ hash.key?('chargePointConnectorTypeDesc') ? hash['chargePointConnectorTypeDesc'] : SKIP
105
+
106
+ # Create a new hash for additional properties, removing known properties.
107
+ new_hash = hash.reject { |k, _| names.value?(k) }
108
+
109
+ additional_properties = APIHelper.get_additional_properties(
110
+ new_hash, proc { |value| value }
111
+ )
112
+
113
+ # Create object from extracted values.
114
+ EvChargingDetails.new(charge_point_serial_id: charge_point_serial_id,
115
+ start_date_time: start_date_time,
116
+ end_date_time: end_date_time,
117
+ duration: duration,
118
+ charge_point_connector_type_cd: charge_point_connector_type_cd,
119
+ charge_point_connector_type_desc: charge_point_connector_type_desc,
120
+ additional_properties: additional_properties)
121
+ end
122
+
123
+ def to_custom_start_date_time
124
+ DateTimeHelper.to_rfc3339(start_date_time)
125
+ end
126
+
127
+ def to_custom_end_date_time
128
+ DateTimeHelper.to_rfc3339(end_date_time)
129
+ end
130
+
131
+ # Provides a human-readable string representation of the object.
132
+ def to_s
133
+ class_name = self.class.name.split('::').last
134
+ "<#{class_name} charge_point_serial_id: #{@charge_point_serial_id},"\
135
+ " charge_point_connector_type_cd: #{@charge_point_connector_type_cd},"\
136
+ " charge_point_connector_type_desc: #{@charge_point_connector_type_desc}, start_date_time:"\
137
+ " #{@start_date_time}, end_date_time: #{@end_date_time}, duration: #{@duration},"\
138
+ " additional_properties: #{@additional_properties}>"
139
+ end
140
+
141
+ # Provides a debugging-friendly string with detailed object information.
142
+ def inspect
143
+ class_name = self.class.name.split('::').last
144
+ "<#{class_name} charge_point_serial_id: #{@charge_point_serial_id.inspect},"\
145
+ " charge_point_connector_type_cd: #{@charge_point_connector_type_cd.inspect},"\
146
+ " charge_point_connector_type_desc: #{@charge_point_connector_type_desc.inspect},"\
147
+ " start_date_time: #{@start_date_time.inspect}, end_date_time: #{@end_date_time.inspect},"\
148
+ " duration: #{@duration.inspect}, additional_properties: #{@additional_properties}>"
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,77 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # ExchangeAccessCodeRequest Model.
8
+ class ExchangeAccessCodeRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # AccessCode provided by Shell after it redirects the user to the partner's
13
+ # URL.
14
+ # @return [String]
15
+ attr_accessor :access_code
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['access_code'] = 'accessCode'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ %w[
27
+ access_code
28
+ ]
29
+ end
30
+
31
+ # An array for nullable fields
32
+ def self.nullables
33
+ []
34
+ end
35
+
36
+ def initialize(access_code: SKIP, additional_properties: nil)
37
+ # Add additional model properties to the instance
38
+ additional_properties = {} if additional_properties.nil?
39
+
40
+ @access_code = access_code unless access_code == SKIP
41
+ @additional_properties = additional_properties
42
+ end
43
+
44
+ # Creates an instance of the object from a hash.
45
+ def self.from_hash(hash)
46
+ return nil unless hash
47
+
48
+ # Extract variables from the hash.
49
+ access_code = hash.key?('accessCode') ? hash['accessCode'] : SKIP
50
+
51
+ # Create a new hash for additional properties, removing known properties.
52
+ new_hash = hash.reject { |k, _| names.value?(k) }
53
+
54
+ additional_properties = APIHelper.get_additional_properties(
55
+ new_hash, proc { |value| value }
56
+ )
57
+
58
+ # Create object from extracted values.
59
+ ExchangeAccessCodeRequest.new(access_code: access_code,
60
+ additional_properties: additional_properties)
61
+ end
62
+
63
+ # Provides a human-readable string representation of the object.
64
+ def to_s
65
+ class_name = self.class.name.split('::').last
66
+ "<#{class_name} access_code: #{@access_code}, additional_properties:"\
67
+ " #{@additional_properties}>"
68
+ end
69
+
70
+ # Provides a debugging-friendly string with detailed object information.
71
+ def inspect
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} access_code: #{@access_code.inspect}, additional_properties:"\
74
+ " #{@additional_properties}>"
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,85 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # Fault Model.
8
+ class Fault < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The description of the error.
13
+ # @return [String]
14
+ attr_accessor :faultstring
15
+
16
+ # The description of the error.
17
+ # @return [FaultDetail]
18
+ attr_accessor :detail
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['faultstring'] = 'faultstring'
24
+ @_hash['detail'] = 'detail'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ faultstring
32
+ detail
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(faultstring: SKIP, detail: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @faultstring = faultstring unless faultstring == SKIP
46
+ @detail = detail unless detail == SKIP
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ faultstring = hash.key?('faultstring') ? hash['faultstring'] : SKIP
56
+ detail = FaultDetail.from_hash(hash['detail']) if hash['detail']
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ Fault.new(faultstring: faultstring,
67
+ detail: detail,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} faultstring: #{@faultstring}, detail: #{@detail}, additional_properties:"\
75
+ " #{@additional_properties}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} faultstring: #{@faultstring.inspect}, detail: #{@detail.inspect},"\
82
+ " additional_properties: #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,76 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # FaultDetail Model.
8
+ class FaultDetail < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The error code.
13
+ # @return [String]
14
+ attr_accessor :errorcode
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['errorcode'] = 'errorcode'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ errorcode
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(errorcode: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @errorcode = errorcode unless errorcode == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ errorcode = hash.key?('errorcode') ? hash['errorcode'] : SKIP
49
+
50
+ # Create a new hash for additional properties, removing known properties.
51
+ new_hash = hash.reject { |k, _| names.value?(k) }
52
+
53
+ additional_properties = APIHelper.get_additional_properties(
54
+ new_hash, proc { |value| value }
55
+ )
56
+
57
+ # Create object from extracted values.
58
+ FaultDetail.new(errorcode: errorcode,
59
+ additional_properties: additional_properties)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} errorcode: #{@errorcode}, additional_properties:"\
66
+ " #{@additional_properties}>"
67
+ end
68
+
69
+ # Provides a debugging-friendly string with detailed object information.
70
+ def inspect
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} errorcode: #{@errorcode.inspect}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,75 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # JsonApiVersion Model.
8
+ class JsonApiVersion < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :version
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['version'] = 'version'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ version
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(version: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @version = version unless version == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ version = hash.key?('version') ? hash['version'] : SKIP
49
+
50
+ # Create a new hash for additional properties, removing known properties.
51
+ new_hash = hash.reject { |k, _| names.value?(k) }
52
+
53
+ additional_properties = APIHelper.get_additional_properties(
54
+ new_hash, proc { |value| value }
55
+ )
56
+
57
+ # Create object from extracted values.
58
+ JsonApiVersion.new(version: version,
59
+ additional_properties: additional_properties)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} version: #{@version}, additional_properties: #{@additional_properties}>"
66
+ end
67
+
68
+ # Provides a debugging-friendly string with detailed object information.
69
+ def inspect
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} version: #{@version.inspect}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,76 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # LoyaltyCardInfo Model.
8
+ class LoyaltyCardInfo < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Loyalty card of the transaction.
13
+ # @return [String]
14
+ attr_accessor :loyalty_card
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['loyalty_card'] = 'loyaltyCard'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ %w[
26
+ loyalty_card
27
+ ]
28
+ end
29
+
30
+ # An array for nullable fields
31
+ def self.nullables
32
+ []
33
+ end
34
+
35
+ def initialize(loyalty_card: SKIP, additional_properties: nil)
36
+ # Add additional model properties to the instance
37
+ additional_properties = {} if additional_properties.nil?
38
+
39
+ @loyalty_card = loyalty_card unless loyalty_card == SKIP
40
+ @additional_properties = additional_properties
41
+ end
42
+
43
+ # Creates an instance of the object from a hash.
44
+ def self.from_hash(hash)
45
+ return nil unless hash
46
+
47
+ # Extract variables from the hash.
48
+ loyalty_card = hash.key?('loyaltyCard') ? hash['loyaltyCard'] : SKIP
49
+
50
+ # Create a new hash for additional properties, removing known properties.
51
+ new_hash = hash.reject { |k, _| names.value?(k) }
52
+
53
+ additional_properties = APIHelper.get_additional_properties(
54
+ new_hash, proc { |value| value }
55
+ )
56
+
57
+ # Create object from extracted values.
58
+ LoyaltyCardInfo.new(loyalty_card: loyalty_card,
59
+ additional_properties: additional_properties)
60
+ end
61
+
62
+ # Provides a human-readable string representation of the object.
63
+ def to_s
64
+ class_name = self.class.name.split('::').last
65
+ "<#{class_name} loyalty_card: #{@loyalty_card}, additional_properties:"\
66
+ " #{@additional_properties}>"
67
+ end
68
+
69
+ # Provides a debugging-friendly string with detailed object information.
70
+ def inspect
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} loyalty_card: #{@loyalty_card.inspect}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,109 @@
1
+ # loyalty_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module LoyaltyApIs
7
+ # M200UserPartners Model.
8
+ class M200UserPartners < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :uuid
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :user_status
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Object]
22
+ attr_accessor :market
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [String]
26
+ attr_accessor :access_token
27
+
28
+ # TODO: Write general description for this method
29
+ # @return [String]
30
+ attr_accessor :refresh_token
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['uuid'] = 'uuid'
36
+ @_hash['user_status'] = 'userStatus'
37
+ @_hash['market'] = 'market'
38
+ @_hash['access_token'] = 'accessToken'
39
+ @_hash['refresh_token'] = 'refreshToken'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ []
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(uuid:, user_status:, market:, access_token:, refresh_token:,
54
+ additional_properties: nil)
55
+ # Add additional model properties to the instance
56
+ additional_properties = {} if additional_properties.nil?
57
+
58
+ @uuid = uuid
59
+ @user_status = user_status
60
+ @market = market
61
+ @access_token = access_token
62
+ @refresh_token = refresh_token
63
+ @additional_properties = additional_properties
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ uuid = hash.key?('uuid') ? hash['uuid'] : nil
72
+ user_status = hash.key?('userStatus') ? hash['userStatus'] : nil
73
+ market = hash.key?('market') ? hash['market'] : nil
74
+ access_token = hash.key?('accessToken') ? hash['accessToken'] : nil
75
+ refresh_token = hash.key?('refreshToken') ? hash['refreshToken'] : nil
76
+
77
+ # Create a new hash for additional properties, removing known properties.
78
+ new_hash = hash.reject { |k, _| names.value?(k) }
79
+
80
+ additional_properties = APIHelper.get_additional_properties(
81
+ new_hash, proc { |value| value }
82
+ )
83
+
84
+ # Create object from extracted values.
85
+ M200UserPartners.new(uuid: uuid,
86
+ user_status: user_status,
87
+ market: market,
88
+ access_token: access_token,
89
+ refresh_token: refresh_token,
90
+ additional_properties: additional_properties)
91
+ end
92
+
93
+ # Provides a human-readable string representation of the object.
94
+ def to_s
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} uuid: #{@uuid}, user_status: #{@user_status}, market: #{@market},"\
97
+ " access_token: #{@access_token}, refresh_token: #{@refresh_token}, additional_properties:"\
98
+ " #{@additional_properties}>"
99
+ end
100
+
101
+ # Provides a debugging-friendly string with detailed object information.
102
+ def inspect
103
+ class_name = self.class.name.split('::').last
104
+ "<#{class_name} uuid: #{@uuid.inspect}, user_status: #{@user_status.inspect}, market:"\
105
+ " #{@market.inspect}, access_token: #{@access_token.inspect}, refresh_token:"\
106
+ " #{@refresh_token.inspect}, additional_properties: #{@additional_properties}>"
107
+ end
108
+ end
109
+ end