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,101 @@
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
+ # OfferBase Model.
8
+ class OfferBase < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Offer ID provided upon offer configuration
13
+ # @return [Integer]
14
+ attr_accessor :offer_id
15
+
16
+ # Unique Reference ID for the transaction from the partner. Used to identify
17
+ # duplicate requests.
18
+ # @return [String]
19
+ attr_accessor :reference_id
20
+
21
+ # Title of the partner's offer, given upon configuration
22
+ # @return [String]
23
+ attr_accessor :title
24
+
25
+ # Description of the partner's offer, set up upon offer configuration
26
+ # @return [String]
27
+ attr_accessor :description
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['offer_id'] = 'offerId'
33
+ @_hash['reference_id'] = 'referenceId'
34
+ @_hash['title'] = 'title'
35
+ @_hash['description'] = 'description'
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(offer_id:, reference_id:, title:, description:,
50
+ additional_properties: nil)
51
+ # Add additional model properties to the instance
52
+ additional_properties = {} if additional_properties.nil?
53
+
54
+ @offer_id = offer_id
55
+ @reference_id = reference_id
56
+ @title = title
57
+ @description = description
58
+ @additional_properties = additional_properties
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ offer_id = hash.key?('offerId') ? hash['offerId'] : nil
67
+ reference_id = hash.key?('referenceId') ? hash['referenceId'] : nil
68
+ title = hash.key?('title') ? hash['title'] : nil
69
+ description = hash.key?('description') ? hash['description'] : nil
70
+
71
+ # Create a new hash for additional properties, removing known properties.
72
+ new_hash = hash.reject { |k, _| names.value?(k) }
73
+
74
+ additional_properties = APIHelper.get_additional_properties(
75
+ new_hash, proc { |value| value }
76
+ )
77
+
78
+ # Create object from extracted values.
79
+ OfferBase.new(offer_id: offer_id,
80
+ reference_id: reference_id,
81
+ title: title,
82
+ description: description,
83
+ additional_properties: additional_properties)
84
+ end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} offer_id: #{@offer_id}, reference_id: #{@reference_id}, title: #{@title},"\
90
+ " description: #{@description}, additional_properties: #{@additional_properties}>"
91
+ end
92
+
93
+ # Provides a debugging-friendly string with detailed object information.
94
+ def inspect
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} offer_id: #{@offer_id.inspect}, reference_id: #{@reference_id.inspect},"\
97
+ " title: #{@title.inspect}, description: #{@description.inspect}, additional_properties:"\
98
+ " #{@additional_properties}>"
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,156 @@
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
+ # OfferInfo Model.
8
+ class OfferInfo < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Discount value of the offer
13
+ # @return [Float]
14
+ attr_accessor :discount_value
15
+
16
+ # Total amount of points awarded for the given product code.
17
+ # @return [Integer]
18
+ attr_accessor :loyalty_offer_amount
19
+
20
+ # Unique ID of the voucher/coupon.
21
+ # @return [String]
22
+ attr_accessor :loyalty_offer_code
23
+
24
+ # Name of loyalty offer
25
+ # @return [String]
26
+ attr_accessor :loyalty_offer_description
27
+
28
+ # Loyalty Offer ID
29
+ # @return [String]
30
+ attr_accessor :loyalty_offer_id
31
+
32
+ # Loyalty offer type
33
+ # @return [String]
34
+ attr_accessor :loyalty_offer_type
35
+
36
+ # Loyalty Scheme code
37
+ # @return [String]
38
+ attr_accessor :loyalty_scheme_code
39
+
40
+ # Offer/reward name
41
+ # @return [String]
42
+ attr_accessor :reason
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ @_hash = {} if @_hash.nil?
47
+ @_hash['discount_value'] = 'discountValue'
48
+ @_hash['loyalty_offer_amount'] = 'loyaltyOfferAmount'
49
+ @_hash['loyalty_offer_code'] = 'loyaltyOfferCode'
50
+ @_hash['loyalty_offer_description'] = 'loyaltyOfferDescription'
51
+ @_hash['loyalty_offer_id'] = 'loyaltyOfferID'
52
+ @_hash['loyalty_offer_type'] = 'loyaltyOfferType'
53
+ @_hash['loyalty_scheme_code'] = 'loyaltySchemeCode'
54
+ @_hash['reason'] = 'reason'
55
+ @_hash
56
+ end
57
+
58
+ # An array for optional fields
59
+ def self.optionals
60
+ %w[
61
+ loyalty_offer_amount
62
+ loyalty_offer_code
63
+ loyalty_offer_description
64
+ loyalty_offer_type
65
+ loyalty_scheme_code
66
+ ]
67
+ end
68
+
69
+ # An array for nullable fields
70
+ def self.nullables
71
+ []
72
+ end
73
+
74
+ def initialize(discount_value:, loyalty_offer_id:, reason:,
75
+ loyalty_offer_amount: SKIP, loyalty_offer_code: SKIP,
76
+ loyalty_offer_description: SKIP, loyalty_offer_type: SKIP,
77
+ loyalty_scheme_code: SKIP, additional_properties: nil)
78
+ # Add additional model properties to the instance
79
+ additional_properties = {} if additional_properties.nil?
80
+
81
+ @discount_value = discount_value
82
+ @loyalty_offer_amount = loyalty_offer_amount unless loyalty_offer_amount == SKIP
83
+ @loyalty_offer_code = loyalty_offer_code unless loyalty_offer_code == SKIP
84
+ unless loyalty_offer_description == SKIP
85
+ @loyalty_offer_description =
86
+ loyalty_offer_description
87
+ end
88
+ @loyalty_offer_id = loyalty_offer_id
89
+ @loyalty_offer_type = loyalty_offer_type unless loyalty_offer_type == SKIP
90
+ @loyalty_scheme_code = loyalty_scheme_code unless loyalty_scheme_code == SKIP
91
+ @reason = reason
92
+ @additional_properties = additional_properties
93
+ end
94
+
95
+ # Creates an instance of the object from a hash.
96
+ def self.from_hash(hash)
97
+ return nil unless hash
98
+
99
+ # Extract variables from the hash.
100
+ discount_value = hash.key?('discountValue') ? hash['discountValue'] : nil
101
+ loyalty_offer_id =
102
+ hash.key?('loyaltyOfferID') ? hash['loyaltyOfferID'] : nil
103
+ reason = hash.key?('reason') ? hash['reason'] : nil
104
+ loyalty_offer_amount =
105
+ hash.key?('loyaltyOfferAmount') ? hash['loyaltyOfferAmount'] : SKIP
106
+ loyalty_offer_code =
107
+ hash.key?('loyaltyOfferCode') ? hash['loyaltyOfferCode'] : SKIP
108
+ loyalty_offer_description =
109
+ hash.key?('loyaltyOfferDescription') ? hash['loyaltyOfferDescription'] : SKIP
110
+ loyalty_offer_type =
111
+ hash.key?('loyaltyOfferType') ? hash['loyaltyOfferType'] : SKIP
112
+ loyalty_scheme_code =
113
+ hash.key?('loyaltySchemeCode') ? hash['loyaltySchemeCode'] : SKIP
114
+
115
+ # Create a new hash for additional properties, removing known properties.
116
+ new_hash = hash.reject { |k, _| names.value?(k) }
117
+
118
+ additional_properties = APIHelper.get_additional_properties(
119
+ new_hash, proc { |value| value }
120
+ )
121
+
122
+ # Create object from extracted values.
123
+ OfferInfo.new(discount_value: discount_value,
124
+ loyalty_offer_id: loyalty_offer_id,
125
+ reason: reason,
126
+ loyalty_offer_amount: loyalty_offer_amount,
127
+ loyalty_offer_code: loyalty_offer_code,
128
+ loyalty_offer_description: loyalty_offer_description,
129
+ loyalty_offer_type: loyalty_offer_type,
130
+ loyalty_scheme_code: loyalty_scheme_code,
131
+ additional_properties: additional_properties)
132
+ end
133
+
134
+ # Provides a human-readable string representation of the object.
135
+ def to_s
136
+ class_name = self.class.name.split('::').last
137
+ "<#{class_name} discount_value: #{@discount_value}, loyalty_offer_amount:"\
138
+ " #{@loyalty_offer_amount}, loyalty_offer_code: #{@loyalty_offer_code},"\
139
+ " loyalty_offer_description: #{@loyalty_offer_description}, loyalty_offer_id:"\
140
+ " #{@loyalty_offer_id}, loyalty_offer_type: #{@loyalty_offer_type}, loyalty_scheme_code:"\
141
+ " #{@loyalty_scheme_code}, reason: #{@reason}, additional_properties:"\
142
+ " #{@additional_properties}>"
143
+ end
144
+
145
+ # Provides a debugging-friendly string with detailed object information.
146
+ def inspect
147
+ class_name = self.class.name.split('::').last
148
+ "<#{class_name} discount_value: #{@discount_value.inspect}, loyalty_offer_amount:"\
149
+ " #{@loyalty_offer_amount.inspect}, loyalty_offer_code: #{@loyalty_offer_code.inspect},"\
150
+ " loyalty_offer_description: #{@loyalty_offer_description.inspect}, loyalty_offer_id:"\
151
+ " #{@loyalty_offer_id.inspect}, loyalty_offer_type: #{@loyalty_offer_type.inspect},"\
152
+ " loyalty_scheme_code: #{@loyalty_scheme_code.inspect}, reason: #{@reason.inspect},"\
153
+ " additional_properties: #{@additional_properties}>"
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,100 @@
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
+ # OfferLanguage Model.
8
+ class OfferLanguage < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique Id of the offer
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Title of the offer
17
+ # @return [String]
18
+ attr_accessor :title
19
+
20
+ # Description of the offer
21
+ # @return [String]
22
+ attr_accessor :description
23
+
24
+ # Custom text of the offer
25
+ # @return [String]
26
+ attr_accessor :custom_text
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['id'] = 'id'
32
+ @_hash['title'] = 'title'
33
+ @_hash['description'] = 'description'
34
+ @_hash['custom_text'] = 'customText'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ []
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(id:, title:, description:, custom_text:,
49
+ additional_properties: nil)
50
+ # Add additional model properties to the instance
51
+ additional_properties = {} if additional_properties.nil?
52
+
53
+ @id = id
54
+ @title = title
55
+ @description = description
56
+ @custom_text = custom_text
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
+ id = hash.key?('id') ? hash['id'] : nil
66
+ title = hash.key?('title') ? hash['title'] : nil
67
+ description = hash.key?('description') ? hash['description'] : nil
68
+ custom_text = hash.key?('customText') ? hash['customText'] : nil
69
+
70
+ # Create a new hash for additional properties, removing known properties.
71
+ new_hash = hash.reject { |k, _| names.value?(k) }
72
+
73
+ additional_properties = APIHelper.get_additional_properties(
74
+ new_hash, proc { |value| value }
75
+ )
76
+
77
+ # Create object from extracted values.
78
+ OfferLanguage.new(id: id,
79
+ title: title,
80
+ description: description,
81
+ custom_text: custom_text,
82
+ additional_properties: additional_properties)
83
+ end
84
+
85
+ # Provides a human-readable string representation of the object.
86
+ def to_s
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} id: #{@id}, title: #{@title}, description: #{@description}, custom_text:"\
89
+ " #{@custom_text}, additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} id: #{@id.inspect}, title: #{@title.inspect}, description:"\
96
+ " #{@description.inspect}, custom_text: #{@custom_text.inspect}, additional_properties:"\
97
+ " #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,99 @@
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
+ # PointsToCash Model.
8
+ class PointsToCash < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The points used for converting it to cash
13
+ # @return [Float]
14
+ attr_accessor :points_redeemed
15
+
16
+ # Total amount in cash used
17
+ # @return [Float]
18
+ attr_accessor :total_amount
19
+
20
+ # Indication if the p2c was used as a method of payment
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :points_to_cash_mop
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['points_redeemed'] = 'pointsRedeemed'
28
+ @_hash['total_amount'] = 'totalAmount'
29
+ @_hash['points_to_cash_mop'] = 'pointsToCashMOP'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ points_redeemed
37
+ total_amount
38
+ points_to_cash_mop
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(points_redeemed: SKIP, total_amount: SKIP,
48
+ points_to_cash_mop: SKIP, additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @points_redeemed = points_redeemed unless points_redeemed == SKIP
53
+ @total_amount = total_amount unless total_amount == SKIP
54
+ @points_to_cash_mop = points_to_cash_mop unless points_to_cash_mop == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ points_redeemed =
64
+ hash.key?('pointsRedeemed') ? hash['pointsRedeemed'] : SKIP
65
+ total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP
66
+ points_to_cash_mop =
67
+ hash.key?('pointsToCashMOP') ? hash['pointsToCashMOP'] : SKIP
68
+
69
+ # Create a new hash for additional properties, removing known properties.
70
+ new_hash = hash.reject { |k, _| names.value?(k) }
71
+
72
+ additional_properties = APIHelper.get_additional_properties(
73
+ new_hash, proc { |value| value }
74
+ )
75
+
76
+ # Create object from extracted values.
77
+ PointsToCash.new(points_redeemed: points_redeemed,
78
+ total_amount: total_amount,
79
+ points_to_cash_mop: points_to_cash_mop,
80
+ additional_properties: additional_properties)
81
+ end
82
+
83
+ # Provides a human-readable string representation of the object.
84
+ def to_s
85
+ class_name = self.class.name.split('::').last
86
+ "<#{class_name} points_redeemed: #{@points_redeemed}, total_amount: #{@total_amount},"\
87
+ " points_to_cash_mop: #{@points_to_cash_mop}, additional_properties:"\
88
+ " #{@additional_properties}>"
89
+ end
90
+
91
+ # Provides a debugging-friendly string with detailed object information.
92
+ def inspect
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} points_redeemed: #{@points_redeemed.inspect}, total_amount:"\
95
+ " #{@total_amount.inspect}, points_to_cash_mop: #{@points_to_cash_mop.inspect},"\
96
+ " additional_properties: #{@additional_properties}>"
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,53 @@
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
+ # Indicating the Type of the product (Fuel, CR, CC, PARTNER, OTHER,
8
+ # GREEN_ENERGY).
9
+ class ProductType
10
+ PRODUCT_TYPE = [
11
+ # TODO: Write general description for FUEL
12
+ FUEL = 'FUEL'.freeze,
13
+
14
+ # TODO: Write general description for CR
15
+ CR = 'CR'.freeze,
16
+
17
+ # TODO: Write general description for CC
18
+ CC = 'CC'.freeze,
19
+
20
+ # TODO: Write general description for PARTNER
21
+ PARTNER = 'PARTNER'.freeze,
22
+
23
+ # TODO: Write general description for OTHER
24
+ OTHER = 'OTHER'.freeze,
25
+
26
+ # TODO: Write general description for GREEN_ENERGY
27
+ GREEN_ENERGY = 'GREEN_ENERGY'.freeze
28
+ ].freeze
29
+
30
+ def self.validate(value)
31
+ return false if value.nil?
32
+
33
+ PRODUCT_TYPE.include?(value)
34
+ end
35
+
36
+ def self.from_value(value, default_value = FUEL)
37
+ return default_value if value.nil?
38
+
39
+ str = value.to_s.strip
40
+
41
+ case str.downcase
42
+ when 'fuel' then FUEL
43
+ when 'cr' then CR
44
+ when 'cc' then CC
45
+ when 'partner' then PARTNER
46
+ when 'other' then OTHER
47
+ when 'green_energy' then GREEN_ENERGY
48
+ else
49
+ default_value
50
+ end
51
+ end
52
+ end
53
+ end