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,221 @@
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
+ # RedeemedItem Model.
8
+ class RedeemedItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Description - currently not in use
13
+ # @return [String]
14
+ attr_accessor :description
15
+
16
+ # Total amount
17
+ # @return [Float]
18
+ attr_accessor :amount
19
+
20
+ # Indicates the Type of the transaction detail row (award, redemption,
21
+ # transfer, voucher, refund or central award).
22
+ # @return [TransactionDetailType]
23
+ attr_accessor :detail_type
24
+
25
+ # Discount amount of sales line
26
+ # @return [Float]
27
+ attr_accessor :discount_amount
28
+
29
+ # Discount amount of sales line
30
+ # @return [Array[OfferInfo]]
31
+ attr_accessor :offer_infos
32
+
33
+ # Discount amount of sales line
34
+ # @return [OfferLanguage]
35
+ attr_accessor :offer_lang
36
+
37
+ # Original amount of sales line
38
+ # @return [Float]
39
+ attr_accessor :original_amount
40
+
41
+ # Original amount of sales line
42
+ # @return [RedeemedItemProduct]
43
+ attr_accessor :product_data
44
+
45
+ # Quantity of product
46
+ # @return [Float]
47
+ attr_accessor :quantity
48
+
49
+ # Value added tax
50
+ # @return [Float]
51
+ attr_accessor :vat_amount
52
+
53
+ # VAT rate of sales line
54
+ # @return [Float]
55
+ attr_accessor :vat_rate
56
+
57
+ # Number of points redeemed. Applicable for redeemedItems and not for
58
+ # saleItems
59
+ # @return [Integer]
60
+ attr_accessor :points
61
+
62
+ # List of vouchers
63
+ # @return [Array[String]]
64
+ attr_accessor :vouchers
65
+
66
+ # List of vouchers
67
+ # @return [Array[VoucherItem]]
68
+ attr_accessor :voucher_items
69
+
70
+ # A mapping from model property names to API property names.
71
+ def self.names
72
+ @_hash = {} if @_hash.nil?
73
+ @_hash['description'] = 'description'
74
+ @_hash['amount'] = 'amount'
75
+ @_hash['detail_type'] = 'detailType'
76
+ @_hash['discount_amount'] = 'discountAmount'
77
+ @_hash['offer_infos'] = 'offerInfos'
78
+ @_hash['offer_lang'] = 'offerLang'
79
+ @_hash['original_amount'] = 'originalAmount'
80
+ @_hash['product_data'] = 'productData'
81
+ @_hash['quantity'] = 'quantity'
82
+ @_hash['vat_amount'] = 'vatAmount'
83
+ @_hash['vat_rate'] = 'vatRate'
84
+ @_hash['points'] = 'points'
85
+ @_hash['vouchers'] = 'vouchers'
86
+ @_hash['voucher_items'] = 'voucherItems'
87
+ @_hash
88
+ end
89
+
90
+ # An array for optional fields
91
+ def self.optionals
92
+ %w[
93
+ description
94
+ offer_lang
95
+ vat_amount
96
+ vat_rate
97
+ points
98
+ vouchers
99
+ voucher_items
100
+ ]
101
+ end
102
+
103
+ # An array for nullable fields
104
+ def self.nullables
105
+ []
106
+ end
107
+
108
+ def initialize(amount:, detail_type:, discount_amount:, offer_infos:,
109
+ original_amount:, product_data:, quantity:,
110
+ description: SKIP, offer_lang: SKIP, vat_amount: SKIP,
111
+ vat_rate: SKIP, points: SKIP, vouchers: SKIP,
112
+ voucher_items: SKIP, additional_properties: nil)
113
+ # Add additional model properties to the instance
114
+ additional_properties = {} if additional_properties.nil?
115
+
116
+ @description = description unless description == SKIP
117
+ @amount = amount
118
+ @detail_type = detail_type
119
+ @discount_amount = discount_amount
120
+ @offer_infos = offer_infos
121
+ @offer_lang = offer_lang unless offer_lang == SKIP
122
+ @original_amount = original_amount
123
+ @product_data = product_data
124
+ @quantity = quantity
125
+ @vat_amount = vat_amount unless vat_amount == SKIP
126
+ @vat_rate = vat_rate unless vat_rate == SKIP
127
+ @points = points unless points == SKIP
128
+ @vouchers = vouchers unless vouchers == SKIP
129
+ @voucher_items = voucher_items unless voucher_items == SKIP
130
+ @additional_properties = additional_properties
131
+ end
132
+
133
+ # Creates an instance of the object from a hash.
134
+ def self.from_hash(hash)
135
+ return nil unless hash
136
+
137
+ # Extract variables from the hash.
138
+ amount = hash.key?('amount') ? hash['amount'] : nil
139
+ detail_type = hash.key?('detailType') ? hash['detailType'] : nil
140
+ discount_amount =
141
+ hash.key?('discountAmount') ? hash['discountAmount'] : nil
142
+ # Parameter is an array, so we need to iterate through it
143
+ offer_infos = nil
144
+ unless hash['offerInfos'].nil?
145
+ offer_infos = []
146
+ hash['offerInfos'].each do |structure|
147
+ offer_infos << (OfferInfo.from_hash(structure) if structure)
148
+ end
149
+ end
150
+
151
+ offer_infos = nil unless hash.key?('offerInfos')
152
+ original_amount =
153
+ hash.key?('originalAmount') ? hash['originalAmount'] : nil
154
+ product_data = RedeemedItemProduct.from_hash(hash['productData']) if hash['productData']
155
+ quantity = hash.key?('quantity') ? hash['quantity'] : nil
156
+ description = hash.key?('description') ? hash['description'] : SKIP
157
+ offer_lang = OfferLanguage.from_hash(hash['offerLang']) if hash['offerLang']
158
+ vat_amount = hash.key?('vatAmount') ? hash['vatAmount'] : SKIP
159
+ vat_rate = hash.key?('vatRate') ? hash['vatRate'] : SKIP
160
+ points = hash.key?('points') ? hash['points'] : SKIP
161
+ vouchers = hash.key?('vouchers') ? hash['vouchers'] : SKIP
162
+ # Parameter is an array, so we need to iterate through it
163
+ voucher_items = nil
164
+ unless hash['voucherItems'].nil?
165
+ voucher_items = []
166
+ hash['voucherItems'].each do |structure|
167
+ voucher_items << (VoucherItem.from_hash(structure) if structure)
168
+ end
169
+ end
170
+
171
+ voucher_items = SKIP unless hash.key?('voucherItems')
172
+
173
+ # Create a new hash for additional properties, removing known properties.
174
+ new_hash = hash.reject { |k, _| names.value?(k) }
175
+
176
+ additional_properties = APIHelper.get_additional_properties(
177
+ new_hash, proc { |value| value }
178
+ )
179
+
180
+ # Create object from extracted values.
181
+ RedeemedItem.new(amount: amount,
182
+ detail_type: detail_type,
183
+ discount_amount: discount_amount,
184
+ offer_infos: offer_infos,
185
+ original_amount: original_amount,
186
+ product_data: product_data,
187
+ quantity: quantity,
188
+ description: description,
189
+ offer_lang: offer_lang,
190
+ vat_amount: vat_amount,
191
+ vat_rate: vat_rate,
192
+ points: points,
193
+ vouchers: vouchers,
194
+ voucher_items: voucher_items,
195
+ additional_properties: additional_properties)
196
+ end
197
+
198
+ # Provides a human-readable string representation of the object.
199
+ def to_s
200
+ class_name = self.class.name.split('::').last
201
+ "<#{class_name} description: #{@description}, amount: #{@amount}, detail_type:"\
202
+ " #{@detail_type}, discount_amount: #{@discount_amount}, offer_infos: #{@offer_infos},"\
203
+ " offer_lang: #{@offer_lang}, original_amount: #{@original_amount}, product_data:"\
204
+ " #{@product_data}, quantity: #{@quantity}, vat_amount: #{@vat_amount}, vat_rate:"\
205
+ " #{@vat_rate}, points: #{@points}, vouchers: #{@vouchers}, voucher_items:"\
206
+ " #{@voucher_items}, additional_properties: #{@additional_properties}>"
207
+ end
208
+
209
+ # Provides a debugging-friendly string with detailed object information.
210
+ def inspect
211
+ class_name = self.class.name.split('::').last
212
+ "<#{class_name} description: #{@description.inspect}, amount: #{@amount.inspect},"\
213
+ " detail_type: #{@detail_type.inspect}, discount_amount: #{@discount_amount.inspect},"\
214
+ " offer_infos: #{@offer_infos.inspect}, offer_lang: #{@offer_lang.inspect}, original_amount:"\
215
+ " #{@original_amount.inspect}, product_data: #{@product_data.inspect}, quantity:"\
216
+ " #{@quantity.inspect}, vat_amount: #{@vat_amount.inspect}, vat_rate: #{@vat_rate.inspect},"\
217
+ " points: #{@points.inspect}, vouchers: #{@vouchers.inspect}, voucher_items:"\
218
+ " #{@voucher_items.inspect}, additional_properties: #{@additional_properties}>"
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,131 @@
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
+ # RedeemedItemProduct Model.
8
+ class RedeemedItemProduct < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique Id of the product
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Name of the product
17
+ # @return [String]
18
+ attr_accessor :name
19
+
20
+ # Indicating the Type of the product (Fuel, CR, CC, PARTNER, OTHER,
21
+ # GREEN_ENERGY).
22
+ # @return [ProductType]
23
+ attr_accessor :product_type
24
+
25
+ # Reason for redemption of points as mentioned by the partner.
26
+ # reasonForRedemption to be populated only for redeemedItems (not for
27
+ # saleItems) when productType = PARTNER.
28
+ # @return [String]
29
+ attr_accessor :reason_for_redemption
30
+
31
+ # Product code of gift item (euroShell Forward Code). To be populated with 3
32
+ # digit Euroshell product code.
33
+ # @return [String]
34
+ attr_accessor :product_code
35
+
36
+ # Product code of gift item (euroShell Forward Code). To be populated with 3
37
+ # digit Euroshell product code.
38
+ # @return [String]
39
+ attr_accessor :product_description
40
+
41
+ # A mapping from model property names to API property names.
42
+ def self.names
43
+ @_hash = {} if @_hash.nil?
44
+ @_hash['id'] = 'id'
45
+ @_hash['name'] = 'name'
46
+ @_hash['product_type'] = 'productType'
47
+ @_hash['reason_for_redemption'] = 'reasonForRedemption'
48
+ @_hash['product_code'] = 'productCode'
49
+ @_hash['product_description'] = 'productDescription'
50
+ @_hash
51
+ end
52
+
53
+ # An array for optional fields
54
+ def self.optionals
55
+ %w[
56
+ reason_for_redemption
57
+ product_code
58
+ product_description
59
+ ]
60
+ end
61
+
62
+ # An array for nullable fields
63
+ def self.nullables
64
+ []
65
+ end
66
+
67
+ def initialize(id:, name:, product_type:, reason_for_redemption: SKIP,
68
+ product_code: SKIP, product_description: SKIP,
69
+ additional_properties: nil)
70
+ # Add additional model properties to the instance
71
+ additional_properties = {} if additional_properties.nil?
72
+
73
+ @id = id
74
+ @name = name
75
+ @product_type = product_type
76
+ @reason_for_redemption = reason_for_redemption unless reason_for_redemption == SKIP
77
+ @product_code = product_code unless product_code == SKIP
78
+ @product_description = product_description unless product_description == SKIP
79
+ @additional_properties = additional_properties
80
+ end
81
+
82
+ # Creates an instance of the object from a hash.
83
+ def self.from_hash(hash)
84
+ return nil unless hash
85
+
86
+ # Extract variables from the hash.
87
+ id = hash.key?('id') ? hash['id'] : nil
88
+ name = hash.key?('name') ? hash['name'] : nil
89
+ product_type = hash.key?('productType') ? hash['productType'] : nil
90
+ reason_for_redemption =
91
+ hash.key?('reasonForRedemption') ? hash['reasonForRedemption'] : SKIP
92
+ product_code = hash.key?('productCode') ? hash['productCode'] : SKIP
93
+ product_description =
94
+ hash.key?('productDescription') ? hash['productDescription'] : SKIP
95
+
96
+ # Create a new hash for additional properties, removing known properties.
97
+ new_hash = hash.reject { |k, _| names.value?(k) }
98
+
99
+ additional_properties = APIHelper.get_additional_properties(
100
+ new_hash, proc { |value| value }
101
+ )
102
+
103
+ # Create object from extracted values.
104
+ RedeemedItemProduct.new(id: id,
105
+ name: name,
106
+ product_type: product_type,
107
+ reason_for_redemption: reason_for_redemption,
108
+ product_code: product_code,
109
+ product_description: product_description,
110
+ additional_properties: additional_properties)
111
+ end
112
+
113
+ # Provides a human-readable string representation of the object.
114
+ def to_s
115
+ class_name = self.class.name.split('::').last
116
+ "<#{class_name} id: #{@id}, name: #{@name}, product_type: #{@product_type},"\
117
+ " reason_for_redemption: #{@reason_for_redemption}, product_code: #{@product_code},"\
118
+ " product_description: #{@product_description}, additional_properties:"\
119
+ " #{@additional_properties}>"
120
+ end
121
+
122
+ # Provides a debugging-friendly string with detailed object information.
123
+ def inspect
124
+ class_name = self.class.name.split('::').last
125
+ "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, product_type:"\
126
+ " #{@product_type.inspect}, reason_for_redemption: #{@reason_for_redemption.inspect},"\
127
+ " product_code: #{@product_code.inspect}, product_description:"\
128
+ " #{@product_description.inspect}, additional_properties: #{@additional_properties}>"
129
+ end
130
+ end
131
+ 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
+ # RedemptionItem Model.
8
+ class RedemptionItem < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The itemID identifies the catalogue item in the loyalty system. Shell will
13
+ # set these up and share the IDs with the partner.
14
+ # @return [String]
15
+ attr_accessor :item_id
16
+
17
+ # Number of items redeemed on the user's behalf. If the quantity is not
18
+ # specified, the system will assume a default quantity of 1. This is not
19
+ # used for the calculation of points, but only for displaying to the user.
20
+ # @return [Integer]
21
+ attr_accessor :quantity
22
+
23
+ # Total number of points to be redeemed from the Shell Loyalty Platform for
24
+ # this item.
25
+ # @return [Integer]
26
+ attr_accessor :points
27
+
28
+ # Reason for the points redemption. This attribute will be shown to the
29
+ # customer via app/web channel under Transaction History.
30
+ # @return [String]
31
+ attr_accessor :reason_for_redemption
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['item_id'] = 'itemId'
37
+ @_hash['quantity'] = 'quantity'
38
+ @_hash['points'] = 'points'
39
+ @_hash['reason_for_redemption'] = 'reasonForRedemption'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ quantity
47
+ ]
48
+ end
49
+
50
+ # An array for nullable fields
51
+ def self.nullables
52
+ []
53
+ end
54
+
55
+ def initialize(item_id:, points:, reason_for_redemption:, quantity: 1,
56
+ additional_properties: nil)
57
+ # Add additional model properties to the instance
58
+ additional_properties = {} if additional_properties.nil?
59
+
60
+ @item_id = item_id
61
+ @quantity = quantity unless quantity == SKIP
62
+ @points = points
63
+ @reason_for_redemption = reason_for_redemption
64
+ @additional_properties = additional_properties
65
+ end
66
+
67
+ # Creates an instance of the object from a hash.
68
+ def self.from_hash(hash)
69
+ return nil unless hash
70
+
71
+ # Extract variables from the hash.
72
+ item_id = hash.key?('itemId') ? hash['itemId'] : nil
73
+ points = hash.key?('points') ? hash['points'] : nil
74
+ reason_for_redemption =
75
+ hash.key?('reasonForRedemption') ? hash['reasonForRedemption'] : nil
76
+ quantity = hash['quantity'] ||= 1
77
+
78
+ # Create a new hash for additional properties, removing known properties.
79
+ new_hash = hash.reject { |k, _| names.value?(k) }
80
+
81
+ additional_properties = APIHelper.get_additional_properties(
82
+ new_hash, proc { |value| value }
83
+ )
84
+
85
+ # Create object from extracted values.
86
+ RedemptionItem.new(item_id: item_id,
87
+ points: points,
88
+ reason_for_redemption: reason_for_redemption,
89
+ quantity: quantity,
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} item_id: #{@item_id}, quantity: #{@quantity}, points: #{@points},"\
97
+ " reason_for_redemption: #{@reason_for_redemption}, 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} item_id: #{@item_id.inspect}, quantity: #{@quantity.inspect}, points:"\
105
+ " #{@points.inspect}, reason_for_redemption: #{@reason_for_redemption.inspect},"\
106
+ " additional_properties: #{@additional_properties}>"
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,107 @@
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
+ # RedemptionRequest Model.
8
+ class RedemptionRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The SSO uuid of the user signed in with Shell credentials.
13
+ # Format: 32 hexadecimal digits grouped the following way:
14
+ # xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
15
+ # See: https://www.wikiwand.com/en/Universally_unique_identifier#/Format
16
+ # @return [UUID | String]
17
+ attr_accessor :uuid
18
+
19
+ # A unique ID for the transaction from the partner. Used to identify
20
+ # duplicate requests.
21
+ # @return [String]
22
+ attr_accessor :reference_id
23
+
24
+ # Specifies the number of points to be redeemed from the user's point
25
+ # balance and the reason for redemption, which will also be shown to the
26
+ # user. Mutiple redemption items can be submitted in a single API request.
27
+ # @return [Array[RedemptionItem]]
28
+ attr_accessor :redemption_req_array
29
+
30
+ # A mapping from model property names to API property names.
31
+ def self.names
32
+ @_hash = {} if @_hash.nil?
33
+ @_hash['uuid'] = 'uuid'
34
+ @_hash['reference_id'] = 'referenceId'
35
+ @_hash['redemption_req_array'] = 'redemptionReqArray'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ []
42
+ end
43
+
44
+ # An array for nullable fields
45
+ def self.nullables
46
+ []
47
+ end
48
+
49
+ def initialize(uuid:, reference_id:, redemption_req_array:,
50
+ additional_properties: nil)
51
+ # Add additional model properties to the instance
52
+ additional_properties = {} if additional_properties.nil?
53
+
54
+ @uuid = uuid
55
+ @reference_id = reference_id
56
+ @redemption_req_array = redemption_req_array
57
+ @additional_properties = additional_properties
58
+ end
59
+
60
+ # Creates an instance of the object from a hash.
61
+ def self.from_hash(hash)
62
+ return nil unless hash
63
+
64
+ # Extract variables from the hash.
65
+ uuid = hash.key?('uuid') ? hash['uuid'] : nil
66
+ reference_id = hash.key?('referenceId') ? hash['referenceId'] : nil
67
+ # Parameter is an array, so we need to iterate through it
68
+ redemption_req_array = nil
69
+ unless hash['redemptionReqArray'].nil?
70
+ redemption_req_array = []
71
+ hash['redemptionReqArray'].each do |structure|
72
+ redemption_req_array << (RedemptionItem.from_hash(structure) if structure)
73
+ end
74
+ end
75
+
76
+ redemption_req_array = nil unless hash.key?('redemptionReqArray')
77
+
78
+ # Create a new hash for additional properties, removing known properties.
79
+ new_hash = hash.reject { |k, _| names.value?(k) }
80
+
81
+ additional_properties = APIHelper.get_additional_properties(
82
+ new_hash, proc { |value| value }
83
+ )
84
+
85
+ # Create object from extracted values.
86
+ RedemptionRequest.new(uuid: uuid,
87
+ reference_id: reference_id,
88
+ redemption_req_array: redemption_req_array,
89
+ additional_properties: additional_properties)
90
+ end
91
+
92
+ # Provides a human-readable string representation of the object.
93
+ def to_s
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} uuid: #{@uuid}, reference_id: #{@reference_id}, redemption_req_array:"\
96
+ " #{@redemption_req_array}, additional_properties: #{@additional_properties}>"
97
+ end
98
+
99
+ # Provides a debugging-friendly string with detailed object information.
100
+ def inspect
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} uuid: #{@uuid.inspect}, reference_id: #{@reference_id.inspect},"\
103
+ " redemption_req_array: #{@redemption_req_array.inspect}, additional_properties:"\
104
+ " #{@additional_properties}>"
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,118 @@
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
+ # RedemptionResponse Model.
8
+ class RedemptionResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A unique Reference ID for the transaction, generated by the partner.
13
+ # @return [String]
14
+ attr_accessor :reference_id
15
+
16
+ # The time and date of the redemption transaction.
17
+ # @return [String]
18
+ attr_accessor :transaction_date_time
19
+
20
+ # The user's current loyalty point balance after the requested items have
21
+ # been redeemed.
22
+ # @return [String]
23
+ attr_accessor :updated_point_balance
24
+
25
+ # This array requests the points to be redeemed from the users point balance
26
+ # for the items requested. The same information will be shown to the user.
27
+ # Multiple items can be redeemed in a single API request.
28
+ # @return [Array[RedemptionResponseItem]]
29
+ attr_accessor :redemption_req_array
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ @_hash = {} if @_hash.nil?
34
+ @_hash['reference_id'] = 'referenceId'
35
+ @_hash['transaction_date_time'] = 'transactionDateTime'
36
+ @_hash['updated_point_balance'] = 'updatedPointBalance'
37
+ @_hash['redemption_req_array'] = 'redemptionReqArray'
38
+ @_hash
39
+ end
40
+
41
+ # An array for optional fields
42
+ def self.optionals
43
+ []
44
+ end
45
+
46
+ # An array for nullable fields
47
+ def self.nullables
48
+ []
49
+ end
50
+
51
+ def initialize(reference_id:, transaction_date_time:,
52
+ updated_point_balance:, redemption_req_array:,
53
+ additional_properties: nil)
54
+ # Add additional model properties to the instance
55
+ additional_properties = {} if additional_properties.nil?
56
+
57
+ @reference_id = reference_id
58
+ @transaction_date_time = transaction_date_time
59
+ @updated_point_balance = updated_point_balance
60
+ @redemption_req_array = redemption_req_array
61
+ @additional_properties = additional_properties
62
+ end
63
+
64
+ # Creates an instance of the object from a hash.
65
+ def self.from_hash(hash)
66
+ return nil unless hash
67
+
68
+ # Extract variables from the hash.
69
+ reference_id = hash.key?('referenceId') ? hash['referenceId'] : nil
70
+ transaction_date_time =
71
+ hash.key?('transactionDateTime') ? hash['transactionDateTime'] : nil
72
+ updated_point_balance =
73
+ hash.key?('updatedPointBalance') ? hash['updatedPointBalance'] : nil
74
+ # Parameter is an array, so we need to iterate through it
75
+ redemption_req_array = nil
76
+ unless hash['redemptionReqArray'].nil?
77
+ redemption_req_array = []
78
+ hash['redemptionReqArray'].each do |structure|
79
+ redemption_req_array << (RedemptionResponseItem.from_hash(structure) if structure)
80
+ end
81
+ end
82
+
83
+ redemption_req_array = nil unless hash.key?('redemptionReqArray')
84
+
85
+ # Create a new hash for additional properties, removing known properties.
86
+ new_hash = hash.reject { |k, _| names.value?(k) }
87
+
88
+ additional_properties = APIHelper.get_additional_properties(
89
+ new_hash, proc { |value| value }
90
+ )
91
+
92
+ # Create object from extracted values.
93
+ RedemptionResponse.new(reference_id: reference_id,
94
+ transaction_date_time: transaction_date_time,
95
+ updated_point_balance: updated_point_balance,
96
+ redemption_req_array: redemption_req_array,
97
+ additional_properties: additional_properties)
98
+ end
99
+
100
+ # Provides a human-readable string representation of the object.
101
+ def to_s
102
+ class_name = self.class.name.split('::').last
103
+ "<#{class_name} reference_id: #{@reference_id}, transaction_date_time:"\
104
+ " #{@transaction_date_time}, updated_point_balance: #{@updated_point_balance},"\
105
+ " redemption_req_array: #{@redemption_req_array}, additional_properties:"\
106
+ " #{@additional_properties}>"
107
+ end
108
+
109
+ # Provides a debugging-friendly string with detailed object information.
110
+ def inspect
111
+ class_name = self.class.name.split('::').last
112
+ "<#{class_name} reference_id: #{@reference_id.inspect}, transaction_date_time:"\
113
+ " #{@transaction_date_time.inspect}, updated_point_balance:"\
114
+ " #{@updated_point_balance.inspect}, redemption_req_array: #{@redemption_req_array.inspect},"\
115
+ " additional_properties: #{@additional_properties}>"
116
+ end
117
+ end
118
+ end