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,238 @@
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
+ # Assigns the campaign to an area or a store. Provide the area and/or store IDs in the respective arrays. If a campaign changes assignments between areas or stores, unassign it from the area. For example, if a campaign is assigned to Area-01, but it must be now assigned to Store-01 within this area, you have to unassign the campaign from Area-01 and assign to Store-01 only. If you want to assign the campaign to stores only, you do not have to send the area ID.
18
+ class AccessSettingsAssign
19
+ # List all area IDs to which the campaign will be assigned.
20
+ attr_accessor :areas_ids
21
+
22
+ # List all store IDs to which the campaign will be assigned.
23
+ attr_accessor :area_stores_ids
24
+
25
+ # List all area IDs where the campaign is assigned to all stores in the area. This assignment is not equal to the assignment to all `area_stores_ids` listed separately.
26
+ attr_accessor :area_all_stores_ids
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'areas_ids' => :'areas_ids',
32
+ :'area_stores_ids' => :'area_stores_ids',
33
+ :'area_all_stores_ids' => :'area_all_stores_ids'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'areas_ids' => :'Array<String>',
46
+ :'area_stores_ids' => :'Array<String>',
47
+ :'area_all_stores_ids' => :'Array<String>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'areas_ids',
55
+ :'area_stores_ids',
56
+ :'area_all_stores_ids'
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'areas_ids')
69
+ if (value = attributes[:'areas_ids']).is_a?(Array)
70
+ self.areas_ids = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:'area_stores_ids')
75
+ if (value = attributes[:'area_stores_ids']).is_a?(Array)
76
+ self.area_stores_ids = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:'area_all_stores_ids')
81
+ if (value = attributes[:'area_all_stores_ids']).is_a?(Array)
82
+ self.area_all_stores_ids = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ areas_ids == o.areas_ids &&
108
+ area_stores_ids == o.area_stores_ids &&
109
+ area_all_stores_ids == o.area_all_stores_ids
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [areas_ids, area_stores_ids, area_all_stores_ids].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = VoucherifySdk.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,238 @@
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
+ # Unassigns the campaign from an area or a store. Provide the area and/or store IDs in the respective arrays. If a campaign changes assignments between areas or stores, unassign it first. For example, if a campaign is assigned to Area-01, but it must be now assigned to Store-01 within this area, you have to unassign the campaign from Area-01 and assigned to Store-01 only. If you want to assign the campaign to stores only, you do not have to send the area ID.
18
+ class AccessSettingsUnassign
19
+ # List all area IDs from which the campaign will be unassigned.
20
+ attr_accessor :areas_ids
21
+
22
+ # List all store IDs from which the campaign will be unassigned.
23
+ attr_accessor :area_stores_ids
24
+
25
+ # List all area IDs where the campaign will be unassigned from all stores in the area. This unassignment is not equal to the unassignment from all `area_stores_ids` listed separately.
26
+ attr_accessor :area_all_stores_ids
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'areas_ids' => :'areas_ids',
32
+ :'area_stores_ids' => :'area_stores_ids',
33
+ :'area_all_stores_ids' => :'area_all_stores_ids'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'areas_ids' => :'Array<String>',
46
+ :'area_stores_ids' => :'Array<String>',
47
+ :'area_all_stores_ids' => :'Array<String>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ :'areas_ids',
55
+ :'area_stores_ids',
56
+ :'area_all_stores_ids'
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'areas_ids')
69
+ if (value = attributes[:'areas_ids']).is_a?(Array)
70
+ self.areas_ids = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:'area_stores_ids')
75
+ if (value = attributes[:'area_stores_ids']).is_a?(Array)
76
+ self.area_stores_ids = value
77
+ end
78
+ end
79
+
80
+ if attributes.key?(:'area_all_stores_ids')
81
+ if (value = attributes[:'area_all_stores_ids']).is_a?(Array)
82
+ self.area_all_stores_ids = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ areas_ids == o.areas_ids &&
108
+ area_stores_ids == o.area_stores_ids &&
109
+ area_all_stores_ids == o.area_all_stores_ids
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [areas_ids, area_stores_ids, area_all_stores_ids].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = VoucherifySdk.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -52,16 +52,19 @@ module VoucherifySdk
52
52
  # Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value)
53
53
  attr_accessor :aggregated_amount_limit
54
54
 
55
- # Determines the order in which the discount is applied to the products or SKUs sent in the `order` object in the request. The counting begins from `0`.
55
+ # Lists which order lines are (not) covered by the discount. The order in the array is determined by the sequence of applied discounts, while the numbers correspond to the order lines sent in the `order` object in the request. The first order line is assigned `0`, the second order line is assigned `1`, and so on.
56
56
  attr_accessor :order_item_indices
57
57
 
58
+ # Lists which units within order lines are covered by the discount. The order line items are listed according to sequence of applied discounts while the `index` corresponds to the order line sent in the `order` object in the request.
59
+ attr_accessor :order_item_units
60
+
58
61
  # Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item.
59
62
  attr_accessor :repeat
60
63
 
61
64
  # Determines how many items are skipped before the discount is applied.
62
65
  attr_accessor :skip_initially
63
66
 
64
- # Determines to which kinds of objects the discount is applicable. `\"ITEM\"` includes products and SKUs.
67
+ # Determines to which kinds of objects the discount is applicable. `ITEM` includes products and SKUs. `UNIT` means particular units within an order line.
65
68
  attr_accessor :target
66
69
 
67
70
  class EnumAttributeValidator
@@ -103,6 +106,7 @@ module VoucherifySdk
103
106
  :'amount_limit' => :'amount_limit',
104
107
  :'aggregated_amount_limit' => :'aggregated_amount_limit',
105
108
  :'order_item_indices' => :'order_item_indices',
109
+ :'order_item_units' => :'order_item_units',
106
110
  :'repeat' => :'repeat',
107
111
  :'skip_initially' => :'skip_initially',
108
112
  :'target' => :'target'
@@ -131,6 +135,7 @@ module VoucherifySdk
131
135
  :'amount_limit' => :'Integer',
132
136
  :'aggregated_amount_limit' => :'Integer',
133
137
  :'order_item_indices' => :'Array<Integer>',
138
+ :'order_item_units' => :'Array<ApplicableToOrderItemUnitsItem>',
134
139
  :'repeat' => :'Integer',
135
140
  :'skip_initially' => :'Integer',
136
141
  :'target' => :'String'
@@ -153,6 +158,7 @@ module VoucherifySdk
153
158
  :'amount_limit',
154
159
  :'aggregated_amount_limit',
155
160
  :'order_item_indices',
161
+ :'order_item_units',
156
162
  :'repeat',
157
163
  :'skip_initially',
158
164
  :'target'
@@ -227,6 +233,12 @@ module VoucherifySdk
227
233
  end
228
234
  end
229
235
 
236
+ if attributes.key?(:'order_item_units')
237
+ if (value = attributes[:'order_item_units']).is_a?(Array)
238
+ self.order_item_units = value
239
+ end
240
+ end
241
+
230
242
  if attributes.key?(:'repeat')
231
243
  self.repeat = attributes[:'repeat']
232
244
  end
@@ -281,6 +293,7 @@ module VoucherifySdk
281
293
  amount_limit == o.amount_limit &&
282
294
  aggregated_amount_limit == o.aggregated_amount_limit &&
283
295
  order_item_indices == o.order_item_indices &&
296
+ order_item_units == o.order_item_units &&
284
297
  repeat == o.repeat &&
285
298
  skip_initially == o.skip_initially &&
286
299
  target == o.target
@@ -295,7 +308,7 @@ module VoucherifySdk
295
308
  # Calculates hash code according to all attributes.
296
309
  # @return [Integer] Hash code
297
310
  def hash
298
- [object, id, source_id, product_id, product_source_id, strict, price, price_formula, effect, quantity_limit, aggregated_quantity_limit, amount_limit, aggregated_amount_limit, order_item_indices, repeat, skip_initially, target].hash
311
+ [object, id, source_id, product_id, product_source_id, strict, price, price_formula, effect, quantity_limit, aggregated_quantity_limit, amount_limit, aggregated_amount_limit, order_item_indices, order_item_units, repeat, skip_initially, target].hash
299
312
  end
300
313
 
301
314
  # Builds the object from hash