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