voucherify 8.0.2 → 8.0.3

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 (214) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/ENDPOINTS-COVERAGE.md +53 -48
  4. data/Gemfile.lock +8 -6
  5. data/README.md +44 -2
  6. data/__tests__/spec/12_validation_rules_spec.rb +1 -15
  7. data/docs/AccessSettings.md +9 -0
  8. data/docs/AccessSettingsAssign.md +10 -0
  9. data/docs/AccessSettingsUnassign.md +10 -0
  10. data/docs/ApplicableTo.md +3 -2
  11. data/docs/ApplicableToOrderItemUnitsItem.md +9 -0
  12. data/docs/ApplicationDetailsItem.md +14 -0
  13. data/docs/AreaStoreCampaignAssignment.md +1 -0
  14. data/docs/BinApi.md +4 -4
  15. data/docs/Campaign.md +1 -1
  16. data/docs/CampaignBase.md +1 -0
  17. data/docs/CampaignsCreateRequestBody.md +1 -0
  18. data/docs/CampaignsCreateResponseBody.md +1 -1
  19. data/docs/CampaignsGetResponseBody.md +1 -1
  20. data/docs/CampaignsUpdateRequestBody.md +1 -0
  21. data/docs/CampaignsUpdateResponseBody.md +1 -1
  22. data/docs/CampaignsVouchersCreateCombinedResponseBodyLoyaltyCard.md +2 -1
  23. data/docs/CampaignsVouchersCreateResponseBodyLoyaltyCard.md +2 -1
  24. data/docs/ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount.md +1 -1
  25. data/docs/CustomerLoyalty.md +1 -1
  26. data/docs/Discount.md +1 -1
  27. data/docs/DiscountUnitMultipleOneUnit.md +1 -1
  28. data/docs/EarningRule.md +1 -0
  29. data/docs/EarningRulePendingPoints.md +9 -0
  30. data/docs/EventSource.md +10 -0
  31. data/docs/EventSourceApiKey.md +9 -0
  32. data/docs/EventSourceUser.md +8 -0
  33. data/docs/InapplicableTo.md +3 -2
  34. data/docs/InapplicableToOrderItemUnitsItem.md +9 -0
  35. data/docs/LoyaltiesApi.md +334 -10
  36. data/docs/LoyaltiesCreateCampaignRequestBody.md +1 -0
  37. data/docs/LoyaltiesEarningRulesCreateResponseBody.md +1 -0
  38. data/docs/LoyaltiesEarningRulesCreateResponseBodyPendingPoints.md +9 -0
  39. data/docs/LoyaltiesEarningRulesDisableResponseBody.md +1 -0
  40. data/docs/LoyaltiesEarningRulesDisableResponseBodyPendingPoints.md +9 -0
  41. data/docs/LoyaltiesEarningRulesEnableResponseBody.md +1 -0
  42. data/docs/LoyaltiesEarningRulesEnableResponseBodyPendingPoints.md +9 -0
  43. data/docs/LoyaltiesEarningRulesGetResponseBody.md +1 -0
  44. data/docs/LoyaltiesEarningRulesGetResponseBodyPendingPoints.md +9 -0
  45. data/docs/LoyaltiesEarningRulesUpdateResponseBody.md +1 -0
  46. data/docs/LoyaltiesEarningRulesUpdateResponseBodyPendingPoints.md +9 -0
  47. data/docs/LoyaltiesMembersCreateResponseBodyLoyaltyCard.md +2 -1
  48. data/docs/LoyaltiesMembersGetResponseBodyLoyaltyCard.md +2 -1
  49. data/docs/LoyaltiesMembersPendingPointsActivateResponseBody.md +14 -0
  50. data/docs/LoyaltiesMembersPendingPointsActivateResponseBodyRelatedObject.md +9 -0
  51. data/docs/LoyaltiesMembersPendingPointsListResponseBody.md +12 -0
  52. data/docs/LoyaltiesMembersRedemptionRedeemResponseBodyVoucherLoyaltyCard.md +2 -1
  53. data/docs/LoyaltiesMembersTransfersCreateResponseBodyLoyaltyCard.md +2 -1
  54. data/docs/LoyaltiesPendingPointsListResponseBody.md +12 -0
  55. data/docs/LoyaltiesUpdateCampaignRequestBody.md +1 -0
  56. data/docs/LoyaltyCardTransactionDetails.md +2 -0
  57. data/docs/LoyaltyCardTransactionDetailsEarningRule.md +1 -1
  58. data/docs/LoyaltyCardTransactionDetailsHolderLoyaltyTier.md +9 -0
  59. data/docs/LoyaltyCardTransactionDetailsLoyaltyTier.md +2 -2
  60. data/docs/LoyaltyMemberLoyaltyCard.md +2 -1
  61. data/docs/LoyaltyPendingPoints.md +17 -0
  62. data/docs/LoyaltyPendingPointsDetails.md +12 -0
  63. data/docs/LoyaltyPendingPointsDetailsEarningRule.md +9 -0
  64. data/docs/LoyaltyPendingPointsDetailsEarningRuleSource.md +8 -0
  65. data/docs/LoyaltyPendingPointsDetailsEvent.md +14 -0
  66. data/docs/LoyaltyPendingPointsDetailsHolderLoyaltyTier.md +9 -0
  67. data/docs/LoyaltyPendingPointsDetailsLoyaltyTier.md +9 -0
  68. data/docs/LoyaltyPendingPointsDetailsOrder.md +9 -0
  69. data/docs/LoyaltyTierExpiration.md +1 -1
  70. data/docs/Order.md +2 -2
  71. data/docs/OrderCalculated.md +11 -11
  72. data/docs/OrderCalculatedItem.md +1 -0
  73. data/docs/OrderRedemptionsEntry.md +1 -1
  74. data/docs/OrdersCreateRequestBody.md +2 -2
  75. data/docs/OrdersCreateResponseBody.md +11 -11
  76. data/docs/OrdersGetResponseBody.md +11 -11
  77. data/docs/OrdersImportCreateRequestBodyItem.md +2 -2
  78. data/docs/OrdersUpdateRequestBody.md +2 -2
  79. data/docs/OrdersUpdateResponseBody.md +11 -11
  80. data/docs/ParameterOrderListPendingPoints.md +7 -0
  81. data/docs/RedeemableLoyaltyCard.md +1 -1
  82. data/docs/RedeemableVoucherLoyaltyCard.md +2 -1
  83. data/docs/RedemptionEntryOrder.md +11 -11
  84. data/docs/RedemptionEntryVoucherLoyaltyCard.md +2 -1
  85. data/docs/RedemptionVoucherLoyaltyCard.md +2 -1
  86. data/docs/RedemptionsGetResponseBodyOrder.md +11 -11
  87. data/docs/RedemptionsGetResponseBodyVoucherLoyaltyCard.md +2 -1
  88. data/docs/RedemptionsListResponseBodyRedemptionsItemOrder.md +11 -11
  89. data/docs/RedemptionsListResponseBodyRedemptionsItemVoucherLoyaltyCard.md +2 -1
  90. data/docs/SimpleLoyaltyCard.md +2 -1
  91. data/docs/TemplatesCampaignsCampaignSetupCreateRequestBody.md +1 -0
  92. data/docs/ValidationsValidateResponseBodyRedeemablesItemResultDiscount.md +1 -1
  93. data/docs/VoucherLoyaltyCard.md +2 -1
  94. data/docs/VoucherTransactionDetails.md +2 -0
  95. data/docs/VoucherTransactionDetailsCustomEvent.md +2 -2
  96. data/docs/VoucherTransactionDetailsEarningRule.md +1 -1
  97. data/docs/VoucherTransactionDetailsEventSchema.md +2 -2
  98. data/docs/VoucherTransactionDetailsHolderLoyaltyTier.md +9 -0
  99. data/docs/VoucherTransactionDetailsLoyaltyTier.md +2 -2
  100. data/docs/VoucherTransactionDetailsRollback.md +1 -1
  101. data/docs/VoucherTransactionDetailsSegment.md +2 -2
  102. data/docs/VoucherWithCategoriesLoyaltyCard.md +2 -1
  103. data/docs/VouchersCreateResponseBodyLoyaltyCard.md +2 -1
  104. data/docs/VouchersDisableResponseBodyLoyaltyCard.md +2 -1
  105. data/docs/VouchersEnableResponseBodyLoyaltyCard.md +2 -1
  106. data/docs/VouchersGetResponseBodyLoyaltyCard.md +2 -1
  107. data/docs/VouchersUpdateResponseBodyLoyaltyCard.md +2 -1
  108. data/lib/VoucherifySdk/api/bin_api.rb +4 -4
  109. data/lib/VoucherifySdk/api/loyalties_api.rb +334 -8
  110. data/lib/VoucherifySdk/models/access_settings.rb +219 -0
  111. data/lib/VoucherifySdk/models/access_settings_assign.rb +238 -0
  112. data/lib/VoucherifySdk/models/access_settings_unassign.rb +238 -0
  113. data/lib/VoucherifySdk/models/applicable_to.rb +16 -3
  114. data/lib/VoucherifySdk/models/applicable_to_order_item_units_item.rb +220 -0
  115. data/lib/VoucherifySdk/models/application_details_item.rb +284 -0
  116. data/lib/VoucherifySdk/models/area_store_campaign_assignment.rb +12 -1
  117. data/lib/VoucherifySdk/models/campaign.rb +13 -13
  118. data/lib/VoucherifySdk/models/campaign_base.rb +13 -4
  119. data/lib/VoucherifySdk/models/campaigns_create_request_body.rb +10 -1
  120. data/lib/VoucherifySdk/models/campaigns_create_response_body.rb +13 -13
  121. data/lib/VoucherifySdk/models/campaigns_get_response_body.rb +13 -13
  122. data/lib/VoucherifySdk/models/campaigns_update_request_body.rb +10 -1
  123. data/lib/VoucherifySdk/models/campaigns_update_response_body.rb +13 -13
  124. data/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card.rb +17 -6
  125. data/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card.rb +17 -6
  126. data/lib/VoucherifySdk/models/client_validations_validate_response_body_redeemables_item_result_discount.rb +1 -0
  127. data/lib/VoucherifySdk/models/customer_loyalty.rb +1 -1
  128. data/lib/VoucherifySdk/models/discount.rb +1 -0
  129. data/lib/VoucherifySdk/models/discount_unit_multiple_one_unit.rb +1 -0
  130. data/lib/VoucherifySdk/models/earning_rule.rb +11 -1
  131. data/lib/VoucherifySdk/models/earning_rule_pending_points.rb +257 -0
  132. data/lib/VoucherifySdk/models/event_source.rb +254 -0
  133. data/lib/VoucherifySdk/models/event_source_api_key.rb +221 -0
  134. data/lib/VoucherifySdk/models/event_source_user.rb +210 -0
  135. data/lib/VoucherifySdk/models/inapplicable_to.rb +16 -3
  136. data/lib/VoucherifySdk/models/inapplicable_to_order_item_units_item.rb +220 -0
  137. data/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb +10 -1
  138. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body.rb +11 -1
  139. data/lib/VoucherifySdk/models/loyalties_earning_rules_create_response_body_pending_points.rb +257 -0
  140. data/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body.rb +11 -1
  141. data/lib/VoucherifySdk/models/loyalties_earning_rules_disable_response_body_pending_points.rb +257 -0
  142. data/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body.rb +11 -1
  143. data/lib/VoucherifySdk/models/loyalties_earning_rules_enable_response_body_pending_points.rb +257 -0
  144. data/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body.rb +11 -1
  145. data/lib/VoucherifySdk/models/loyalties_earning_rules_get_response_body_pending_points.rb +257 -0
  146. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body.rb +11 -1
  147. data/lib/VoucherifySdk/models/loyalties_earning_rules_update_response_body_pending_points.rb +257 -0
  148. data/lib/VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card.rb +17 -6
  149. data/lib/VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card.rb +17 -6
  150. data/lib/VoucherifySdk/models/loyalties_members_pending_points_activate_response_body.rb +309 -0
  151. data/lib/VoucherifySdk/models/loyalties_members_pending_points_activate_response_body_related_object.rb +247 -0
  152. data/lib/VoucherifySdk/models/loyalties_members_pending_points_list_response_body.rb +286 -0
  153. data/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.rb +17 -6
  154. data/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb +17 -6
  155. data/lib/VoucherifySdk/models/loyalties_pending_points_list_response_body.rb +286 -0
  156. data/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb +10 -1
  157. data/lib/VoucherifySdk/models/loyalty_card_transaction_details.rb +20 -1
  158. data/lib/VoucherifySdk/models/loyalty_card_transaction_details_earning_rule.rb +1 -1
  159. data/lib/VoucherifySdk/models/loyalty_card_transaction_details_holder_loyalty_tier.rb +221 -0
  160. data/lib/VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier.rb +3 -1
  161. data/lib/VoucherifySdk/models/loyalty_card_transactions_type.rb +2 -1
  162. data/lib/VoucherifySdk/models/loyalty_member_loyalty_card.rb +17 -6
  163. data/lib/VoucherifySdk/models/loyalty_pending_points.rb +314 -0
  164. data/lib/VoucherifySdk/models/loyalty_pending_points_details.rb +249 -0
  165. data/lib/VoucherifySdk/models/loyalty_pending_points_details_earning_rule.rb +220 -0
  166. data/lib/VoucherifySdk/models/loyalty_pending_points_details_earning_rule_source.rb +210 -0
  167. data/lib/VoucherifySdk/models/loyalty_pending_points_details_event.rb +302 -0
  168. data/lib/VoucherifySdk/models/loyalty_pending_points_details_holder_loyalty_tier.rb +221 -0
  169. data/lib/VoucherifySdk/models/loyalty_pending_points_details_loyalty_tier.rb +221 -0
  170. data/lib/VoucherifySdk/models/loyalty_pending_points_details_order.rb +221 -0
  171. data/lib/VoucherifySdk/models/loyalty_tier_expiration.rb +1 -1
  172. data/lib/VoucherifySdk/models/order.rb +2 -2
  173. data/lib/VoucherifySdk/models/order_calculated.rb +28 -28
  174. data/lib/VoucherifySdk/models/order_calculated_item.rb +17 -5
  175. data/lib/VoucherifySdk/models/order_redemptions_entry.rb +1 -1
  176. data/lib/VoucherifySdk/models/orders_create_request_body.rb +2 -2
  177. data/lib/VoucherifySdk/models/orders_create_response_body.rb +28 -28
  178. data/lib/VoucherifySdk/models/orders_get_response_body.rb +28 -28
  179. data/lib/VoucherifySdk/models/orders_import_create_request_body_item.rb +2 -2
  180. data/lib/VoucherifySdk/models/orders_update_request_body.rb +2 -2
  181. data/lib/VoucherifySdk/models/orders_update_response_body.rb +28 -28
  182. data/lib/VoucherifySdk/models/parameter_order_list_pending_points.rb +40 -0
  183. data/lib/VoucherifySdk/models/qualifications_option.rb +3 -3
  184. data/lib/VoucherifySdk/models/redeemable_loyalty_card.rb +1 -1
  185. data/lib/VoucherifySdk/models/redeemable_voucher_loyalty_card.rb +17 -6
  186. data/lib/VoucherifySdk/models/redemption_entry_order.rb +28 -28
  187. data/lib/VoucherifySdk/models/redemption_entry_voucher_loyalty_card.rb +17 -6
  188. data/lib/VoucherifySdk/models/redemption_voucher_loyalty_card.rb +17 -6
  189. data/lib/VoucherifySdk/models/redemptions_get_response_body_order.rb +28 -28
  190. data/lib/VoucherifySdk/models/redemptions_get_response_body_voucher_loyalty_card.rb +17 -6
  191. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_order.rb +27 -28
  192. data/lib/VoucherifySdk/models/redemptions_list_response_body_redemptions_item_voucher_loyalty_card.rb +17 -6
  193. data/lib/VoucherifySdk/models/simple_loyalty_card.rb +17 -6
  194. data/lib/VoucherifySdk/models/templates_campaigns_campaign_setup_create_request_body.rb +10 -1
  195. data/lib/VoucherifySdk/models/validations_validate_response_body_redeemables_item_result_discount.rb +1 -0
  196. data/lib/VoucherifySdk/models/voucher_loyalty_card.rb +17 -6
  197. data/lib/VoucherifySdk/models/voucher_transaction.rb +1 -1
  198. data/lib/VoucherifySdk/models/voucher_transaction_details.rb +20 -1
  199. data/lib/VoucherifySdk/models/voucher_transaction_details_custom_event.rb +2 -2
  200. data/lib/VoucherifySdk/models/voucher_transaction_details_earning_rule.rb +1 -1
  201. data/lib/VoucherifySdk/models/voucher_transaction_details_event_schema.rb +2 -2
  202. data/lib/VoucherifySdk/models/voucher_transaction_details_holder_loyalty_tier.rb +221 -0
  203. data/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb +3 -1
  204. data/lib/VoucherifySdk/models/voucher_transaction_details_rollback.rb +1 -1
  205. data/lib/VoucherifySdk/models/voucher_transaction_details_segment.rb +2 -0
  206. data/lib/VoucherifySdk/models/voucher_with_categories_loyalty_card.rb +17 -6
  207. data/lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb +17 -6
  208. data/lib/VoucherifySdk/models/vouchers_disable_response_body_loyalty_card.rb +17 -6
  209. data/lib/VoucherifySdk/models/vouchers_enable_response_body_loyalty_card.rb +17 -6
  210. data/lib/VoucherifySdk/models/vouchers_get_response_body_loyalty_card.rb +17 -6
  211. data/lib/VoucherifySdk/models/vouchers_update_response_body_loyalty_card.rb +17 -6
  212. data/lib/VoucherifySdk/version.rb +1 -1
  213. data/lib/VoucherifySdk.rb +30 -0
  214. metadata +96 -36
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #Voucherify API
3
+
4
+ #Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.
5
+
6
+ The version of the OpenAPI document: v2018-08-01
7
+ Contact: support@voucherify.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VoucherifySdk
17
+ # Details about the event that created pending points.
18
+ class LoyaltyPendingPointsDetailsEvent
19
+ # Unique event identifier, assigned by Voucherify.
20
+ attr_accessor :id
21
+
22
+ # Type of the event that triggered the creation of pending points.
23
+ attr_accessor :type
24
+
25
+ # Unique identifier of the request that triggered the event, assigned by Voucherify.
26
+ attr_accessor :group_id
27
+
28
+ # Unique identifier of the entity that triggered the event, assigned by Voucherify. For pending points, it is the `customer_id` of the customer who paid for the order.
29
+ attr_accessor :entity_id
30
+
31
+ # Timestamp representing the date and time when the event occurred. The value is shown in the ISO 8601 format.
32
+ attr_accessor :created_at
33
+
34
+ # Type of the event.
35
+ attr_accessor :category
36
+
37
+ attr_accessor :event_source
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'id' => :'id',
65
+ :'type' => :'type',
66
+ :'group_id' => :'group_id',
67
+ :'entity_id' => :'entity_id',
68
+ :'created_at' => :'created_at',
69
+ :'category' => :'category',
70
+ :'event_source' => :'event_source'
71
+ }
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'id' => :'String',
83
+ :'type' => :'String',
84
+ :'group_id' => :'String',
85
+ :'entity_id' => :'String',
86
+ :'created_at' => :'Time',
87
+ :'category' => :'String',
88
+ :'event_source' => :'EventSource'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ :'id',
96
+ :'type',
97
+ :'group_id',
98
+ :'entity_id',
99
+ :'created_at',
100
+ :'category',
101
+ ])
102
+ end
103
+
104
+ # Initializes the object
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ def initialize(attributes = {})
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'id')
113
+ self.id = attributes[:'id']
114
+ end
115
+
116
+ if attributes.key?(:'type')
117
+ self.type = attributes[:'type']
118
+ else
119
+ self.type = 'customer.order.paid'
120
+ end
121
+
122
+ if attributes.key?(:'group_id')
123
+ self.group_id = attributes[:'group_id']
124
+ end
125
+
126
+ if attributes.key?(:'entity_id')
127
+ self.entity_id = attributes[:'entity_id']
128
+ end
129
+
130
+ if attributes.key?(:'created_at')
131
+ self.created_at = attributes[:'created_at']
132
+ end
133
+
134
+ if attributes.key?(:'category')
135
+ self.category = attributes[:'category']
136
+ end
137
+
138
+ if attributes.key?(:'event_source')
139
+ self.event_source = attributes[:'event_source']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ invalid_properties
149
+ end
150
+
151
+ # Check to see if the all the properties in the model are valid
152
+ # @return true if the model is valid
153
+ def valid?
154
+ warn '[DEPRECATED] the `valid?` method is obsolete'
155
+ type_validator = EnumAttributeValidator.new('String', ["customer.order.paid"])
156
+ return false unless type_validator.valid?(@type)
157
+ category_validator = EnumAttributeValidator.new('String', ["ACTION", "EFFECT"])
158
+ return false unless category_validator.valid?(@category)
159
+ true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ id == o.id &&
168
+ type == o.type &&
169
+ group_id == o.group_id &&
170
+ entity_id == o.entity_id &&
171
+ created_at == o.created_at &&
172
+ category == o.category &&
173
+ event_source == o.event_source
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [id, type, group_id, entity_id, created_at, category, event_source].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ transformed_hash = {}
195
+ openapi_types.each_pair do |key, type|
196
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = nil
198
+ elsif type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[attribute_map[key]].is_a?(Array)
202
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
203
+ end
204
+ elsif !attributes[attribute_map[key]].nil?
205
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
206
+ end
207
+ end
208
+ new(transformed_hash)
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def self._deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = VoucherifySdk.const_get(type)
250
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Voucherify API
3
+
4
+ #Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.
5
+
6
+ The version of the OpenAPI document: v2018-08-01
7
+ Contact: support@voucherify.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module VoucherifySdk
17
+ # Loyalty tier of the loyalty card holder at the moment when the transaction occurred. The loyalty tier is the tier in which the holder was at the moment pending points were created.
18
+ class LoyaltyPendingPointsDetailsHolderLoyaltyTier
19
+ # Unique identifier of the loyalty tier, assigned by Voucherify.
20
+ attr_accessor :id
21
+
22
+ # User-defined name of the loyalty tier.
23
+ attr_accessor :name
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'id' => :'id',
29
+ :'name' => :'name'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'id' => :'String',
42
+ :'name' => :'String'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ :'id',
50
+ :'name'
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'id')
63
+ self.id = attributes[:'id']
64
+ end
65
+
66
+ if attributes.key?(:'name')
67
+ self.name = attributes[:'name']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ id == o.id &&
92
+ name == o.name
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [id, name].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ transformed_hash = {}
114
+ openapi_types.each_pair do |key, type|
115
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
116
+ transformed_hash["#{key}"] = nil
117
+ elsif type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[attribute_map[key]].is_a?(Array)
121
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
122
+ end
123
+ elsif !attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
125
+ end
126
+ end
127
+ new(transformed_hash)
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def self._deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = VoucherifySdk.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end