voucherify 8.2.0 → 8.3.0
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 +17 -15
- data/Gemfile.lock +9 -9
- data/README.md +12 -0
- data/__tests__/lib/campaigns.rb +2 -2
- data/__tests__/spec/snapshots/campaigns/created_validation_rule_applicable_to.snap +1 -1
- data/__tests__/spec/snapshots/campaigns/created_validation_rule_more_than.snap +1 -1
- data/docs/AccessSettingsAssign.md +3 -3
- data/docs/AccessSettingsProductCollectionAssignmentsList.md +11 -0
- data/docs/AccessSettingsUnassign.md +3 -3
- data/docs/ApplicableTo.md +1 -1
- data/docs/AreaStoreProductCollectionAssignment.md +14 -0
- data/docs/Campaign.md +2 -2
- data/docs/CampaignBase.md +2 -2
- data/docs/CampaignsApi.md +4 -4
- data/docs/CampaignsCreateRequestBody.md +2 -2
- data/docs/CampaignsCreateResponseBody.md +2 -2
- data/docs/CampaignsGetResponseBody.md +2 -2
- data/docs/CampaignsUpdateRequestBody.md +2 -2
- data/docs/CampaignsUpdateResponseBody.md +2 -2
- data/docs/CardDailyReportEntry.md +3 -1
- data/docs/CardLifetimeBucketPoints.md +2 -0
- data/docs/CustomerLoyalty.md +2 -2
- data/docs/CustomerLoyaltyCampaignsEntry.md +1 -1
- data/docs/CustomersApi.md +4 -4
- data/docs/InapplicableTo.md +1 -1
- data/docs/LV2BenefitsApi.md +1 -1
- data/docs/LV2EarningRulesApi.md +1 -1
- data/docs/LV2ExamineApi.md +2 -2
- data/docs/LV2ProgramsApi.md +44 -44
- data/docs/LV2RewardsApi.md +1 -1
- data/docs/ListPublicationsItemVoucher.md +1 -1
- data/docs/LoyaltiesApi.md +6 -6
- data/docs/LoyaltiesCreateCampaignRequestBody.md +2 -2
- data/docs/LoyaltiesCreateCampaignResponseBody.md +2 -2
- data/docs/LoyaltiesGetCampaignResponseBody.md +2 -2
- data/docs/LoyaltiesListMembersResponseBody.md +1 -1
- data/docs/LoyaltiesMembersRedemptionRedeemResponseBodyChannel.md +1 -1
- data/docs/LoyaltiesRewardAssignmentsGetResponseBody.md +2 -2
- data/docs/LoyaltiesRewardAssignmentsGetResponseBodyParametersLoyalty.md +1 -1
- data/docs/LoyaltiesRewardAssignmentsRewardGetResponseBody.md +1 -1
- data/docs/LoyaltiesRewardsCreateAssignmentResponseBody.md +2 -2
- data/docs/LoyaltiesRewardsCreateAssignmentResponseBodyParametersLoyalty.md +1 -1
- data/docs/LoyaltiesRewardsGetResponseBody.md +2 -2
- data/docs/LoyaltiesRewardsGetResponseBodyParametersLoyalty.md +1 -1
- data/docs/LoyaltiesRewardsUpdateAssignmentRequestBodyParametersLoyalty.md +1 -1
- data/docs/LoyaltiesRewardsUpdateAssignmentResponseBody.md +2 -2
- data/docs/LoyaltiesRewardsUpdateAssignmentResponseBodyParametersLoyalty.md +1 -1
- data/docs/LoyaltiesTiersListResponseBody.md +1 -1
- data/docs/LoyaltiesUpdateCampaignRequestBody.md +2 -2
- data/docs/LoyaltiesUpdateCampaignResponseBody.md +2 -2
- data/docs/LoyaltyCampaign.md +2 -2
- data/docs/LoyaltyV2ActivityBenefitStockLimited.md +1 -1
- data/docs/LoyaltyV2ActivityEarningRuleEffectPointsExpirationCalendarExpirationDate.md +1 -1
- data/docs/LoyaltyV2ActivityEarningRuleEffectPointsExpirationRollingExpirationRounding.md +1 -1
- data/docs/LoyaltyV2ActivityEarningRulePointsProportionalEvery.md +1 -1
- data/docs/LoyaltyV2ActivityEarningRulePointsProportionalMetadata.md +1 -1
- data/docs/ManagementApi.md +2 -2
- data/docs/ManagementProjectsCreateRequestBodyUsersItem.md +2 -2
- data/docs/ManagementProjectsUsersAssignRequestBody.md +2 -2
- data/docs/MetadataSchemasApi.md +1 -1
- data/docs/ProductCollectionsApi.md +4 -4
- data/docs/ProductCollectionsCreateRequestBody.md +1 -0
- data/docs/ProductCollectionsCreateResponseBody.md +2 -0
- data/docs/ProductCollectionsGetResponseBody.md +2 -0
- data/docs/ProductCollectionsItem.md +2 -0
- data/docs/ProductCollectionsListResponseBody.md +1 -1
- data/docs/ProductsApi.md +1 -1
- data/docs/RedemptionChannel.md +1 -1
- data/docs/RedemptionRewardResult.md +1 -1
- data/docs/RedemptionRewardResultParametersCoin.md +1 -1
- data/docs/Reward.md +1 -1
- data/docs/RewardAssignment.md +2 -2
- data/docs/RewardAssignmentParametersLoyalty.md +1 -1
- data/docs/RewardType.md +1 -0
- data/docs/RewardTypeCoin.md +2 -2
- data/docs/RewardTypeLoyaltyPoints.md +11 -0
- data/docs/RewardsApi.md +5 -5
- data/docs/RewardsAssignmentsCreateRequestBody.md +2 -0
- data/docs/RewardsAssignmentsCreateRequestBodyParametersLoyalty.md +1 -1
- data/docs/RewardsAssignmentsCreateResponseBody.md +2 -2
- data/docs/RewardsAssignmentsCreateResponseBodyParametersLoyalty.md +1 -1
- data/docs/RewardsAssignmentsGetResponseBody.md +2 -2
- data/docs/RewardsAssignmentsGetResponseBodyParametersLoyalty.md +1 -1
- data/docs/RewardsAssignmentsUpdateRequestBodyParametersLoyalty.md +1 -1
- data/docs/RewardsAssignmentsUpdateResponseBody.md +2 -2
- data/docs/RewardsAssignmentsUpdateResponseBodyParametersLoyalty.md +1 -1
- data/docs/RewardsCreateRequestBody.md +1 -0
- data/docs/RewardsCreateRequestBodyParameters.md +1 -0
- data/docs/RewardsCreateRequestBodyParametersCoin.md +1 -1
- data/docs/RewardsCreateRequestBodyParametersLoyaltyPoints.md +11 -0
- data/docs/RewardsCreateResponseBody.md +1 -1
- data/docs/RewardsUpdateRequestBodyParameters.md +1 -0
- data/docs/RewardsUpdateRequestBodyParametersCoin.md +1 -1
- data/docs/RewardsUpdateRequestBodyParametersLoyaltyPoints.md +11 -0
- data/docs/RewardsUpdateResponseBody.md +1 -1
- data/docs/TemplatesApi.md +1 -1
- data/docs/TemplatesCampaignsCampaignSetupCreateRequestBody.md +2 -2
- data/docs/V2LoyaltiesBenefitsGetResponseBody.md +1 -1
- data/docs/V2LoyaltiesBenefitsGetResponseBodyPoints.md +1 -1
- data/docs/V2LoyaltiesBenefitsGetResponseBodyPointsProportional.md +2 -2
- data/docs/V2LoyaltiesEarningRulesGetResponseBody.md +1 -1
- data/docs/VouchersApi.md +6 -6
- data/lib/VoucherifySdk/api/campaigns_api.rb +6 -6
- data/lib/VoucherifySdk/api/customers_api.rb +4 -4
- data/lib/VoucherifySdk/api/loyalties_api.rb +8 -8
- data/lib/VoucherifySdk/api/lv2_benefits_api.rb +2 -2
- data/lib/VoucherifySdk/api/lv2_earning_rules_api.rb +2 -2
- data/lib/VoucherifySdk/api/lv2_examine_api.rb +4 -4
- data/lib/VoucherifySdk/api/lv2_programs_api.rb +88 -88
- data/lib/VoucherifySdk/api/lv2_rewards_api.rb +2 -2
- data/lib/VoucherifySdk/api/management_api.rb +4 -4
- data/lib/VoucherifySdk/api/metadata_schemas_api.rb +2 -2
- data/lib/VoucherifySdk/api/product_collections_api.rb +8 -8
- data/lib/VoucherifySdk/api/products_api.rb +2 -2
- data/lib/VoucherifySdk/api/rewards_api.rb +8 -8
- data/lib/VoucherifySdk/api/templates_api.rb +2 -2
- data/lib/VoucherifySdk/api/vouchers_api.rb +12 -12
- data/lib/VoucherifySdk/models/access_settings.rb +1 -1
- data/lib/VoucherifySdk/models/access_settings_assign.rb +4 -4
- data/lib/VoucherifySdk/models/access_settings_product_collection_assignments_list.rb +280 -0
- data/lib/VoucherifySdk/models/access_settings_unassign.rb +4 -4
- data/lib/VoucherifySdk/models/applicable_to.rb +1 -1
- data/lib/VoucherifySdk/models/area_store_product_collection_assignment.rb +302 -0
- data/lib/VoucherifySdk/models/benefit_points_proportional_custom_event_metadata.rb +1 -1
- data/lib/VoucherifySdk/models/benefit_points_proportional_customer_metadata.rb +1 -1
- data/lib/VoucherifySdk/models/benefit_points_proportional_order_amount.rb +1 -1
- data/lib/VoucherifySdk/models/benefit_points_proportional_order_metadata.rb +1 -1
- data/lib/VoucherifySdk/models/benefit_points_proportional_order_total_amount.rb +1 -1
- data/lib/VoucherifySdk/models/campaign.rb +2 -2
- data/lib/VoucherifySdk/models/campaign_base.rb +2 -2
- data/lib/VoucherifySdk/models/campaign_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/campaign_loyalty_card_expiration_rules.rb +1 -1
- data/lib/VoucherifySdk/models/campaigns_create_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_create_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_get_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_update_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_update_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/campaigns_vouchers_create_combined_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/campaigns_vouchers_create_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/card_daily_report_entry.rb +24 -2
- data/lib/VoucherifySdk/models/card_lifetime_bucket_points.rb +31 -5
- data/lib/VoucherifySdk/models/card_transaction.rb +1 -1
- data/lib/VoucherifySdk/models/client_events_create_request_body_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/customer_loyalty.rb +3 -2
- data/lib/VoucherifySdk/models/customer_loyalty_campaigns_entry.rb +2 -2
- data/lib/VoucherifySdk/models/customer_summary_redemptions_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/earning_rule.rb +1 -0
- data/lib/VoucherifySdk/models/events_create_request_body_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/inapplicable_to.rb +1 -1
- data/lib/VoucherifySdk/models/list_publications_item_voucher.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_create_campaign_request_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_create_campaign_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_custom_event.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_earning_rules_create_request_body_item_segment.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_earning_rules_list_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_earning_rules_update_request_body.rb +1 -0
- data/lib/VoucherifySdk/models/loyalties_get_campaign_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_list_campaigns_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_list_members_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_loyalty_tier_reward.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_create_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_get_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_channel.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_redemption_redeem_response_body_voucher_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_members_transfers_create_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_programs_members_benefits_transactions_list_request_query_benefit_id.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_reward_assignments_get_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_reward_assignments_reward_get_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_rewards_create_assignment_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_rewards_get_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_rewards_get_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_request_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_rewards_update_assignment_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_tiers_list_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/loyalties_transfer_points.rb +1 -0
- data/lib/VoucherifySdk/models/loyalties_update_campaign_request_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalties_update_campaign_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/loyalty_campaign.rb +3 -2
- data/lib/VoucherifySdk/models/loyalty_campaign_voucher.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_card_transaction_details_holder_loyalty_tier.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_card_transaction_details_loyalty_tier.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_member.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_member_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_pending_points_details_holder_loyalty_tier.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_tier.rb +1 -0
- data/lib/VoucherifySdk/models/loyalty_tiers_expiration_all.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_v2_activity_benefit_stock_limited.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_v2_activity_earning_rule_effect_points_expiration_calendar_expiration_date.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_v2_activity_earning_rule_effect_points_expiration_rolling_expiration_rounding.rb +2 -2
- data/lib/VoucherifySdk/models/loyalty_v2_activity_earning_rule_points_proportional_every.rb +1 -1
- data/lib/VoucherifySdk/models/loyalty_v2_activity_earning_rule_points_proportional_metadata.rb +1 -1
- data/lib/VoucherifySdk/models/management_projects_create_request_body_users_item.rb +2 -2
- data/lib/VoucherifySdk/models/management_projects_users_assign_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/member_activity.rb +1 -1
- data/lib/VoucherifySdk/models/parameter_filters_list_customer_redeemables_campaign_type.rb +1 -1
- data/lib/VoucherifySdk/models/product_collections_create_request_body.rb +10 -1
- data/lib/VoucherifySdk/models/product_collections_create_response_body.rb +21 -1
- data/lib/VoucherifySdk/models/product_collections_get_response_body.rb +21 -1
- data/lib/VoucherifySdk/models/product_collections_item.rb +21 -1
- data/lib/VoucherifySdk/models/product_collections_list_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/redeemable_voucher_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/redemption_channel.rb +1 -1
- data/lib/VoucherifySdk/models/redemption_reward_result.rb +2 -2
- data/lib/VoucherifySdk/models/redemption_reward_result_parameters_coin.rb +2 -2
- data/lib/VoucherifySdk/models/redemption_voucher_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/reward.rb +2 -2
- data/lib/VoucherifySdk/models/reward_assignment.rb +3 -3
- data/lib/VoucherifySdk/models/reward_assignment_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/reward_type.rb +15 -5
- data/lib/VoucherifySdk/models/reward_type_coin.rb +3 -3
- data/lib/VoucherifySdk/models/reward_type_loyalty_points.rb +284 -0
- data/lib/VoucherifySdk/models/rewards_assignments_create_request_body.rb +50 -5
- data/lib/VoucherifySdk/models/rewards_assignments_create_request_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/rewards_assignments_create_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/rewards_assignments_create_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/rewards_assignments_get_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/rewards_assignments_get_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/rewards_assignments_update_request_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/rewards_assignments_update_response_body.rb +3 -3
- data/lib/VoucherifySdk/models/rewards_assignments_update_response_body_parameters_loyalty.rb +1 -1
- data/lib/VoucherifySdk/models/rewards_create_request_body.rb +35 -1
- data/lib/VoucherifySdk/models/rewards_create_request_body_parameters.rb +15 -5
- data/lib/VoucherifySdk/models/rewards_create_request_body_parameters_coin.rb +2 -2
- data/lib/VoucherifySdk/models/rewards_create_request_body_parameters_loyalty_points.rb +284 -0
- data/lib/VoucherifySdk/models/rewards_create_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/rewards_update_request_body_parameters.rb +15 -5
- data/lib/VoucherifySdk/models/rewards_update_request_body_parameters_coin.rb +2 -2
- data/lib/VoucherifySdk/models/rewards_update_request_body_parameters_loyalty_points.rb +284 -0
- data/lib/VoucherifySdk/models/rewards_update_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/simple_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/templates_campaigns_campaign_setup_create_request_body.rb +2 -2
- data/lib/VoucherifySdk/models/v2_loyalties_benefits_get_response_body.rb +1 -1
- data/lib/VoucherifySdk/models/v2_loyalties_benefits_get_response_body_points.rb +1 -1
- data/lib/VoucherifySdk/models/v2_loyalties_benefits_get_response_body_points_proportional.rb +3 -3
- data/lib/VoucherifySdk/models/v2_loyalties_earning_rules_get_response_body.rb +2 -2
- data/lib/VoucherifySdk/models/voucher_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/voucher_transaction_details_holder_loyalty_tier.rb +1 -1
- data/lib/VoucherifySdk/models/voucher_transaction_details_loyalty_tier.rb +1 -1
- data/lib/VoucherifySdk/models/voucher_with_categories_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/vouchers_create_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/vouchers_disable_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/vouchers_enable_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/vouchers_get_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/models/vouchers_update_response_body_loyalty_card.rb +1 -1
- data/lib/VoucherifySdk/version.rb +1 -1
- data/lib/VoucherifySdk.rb +5 -0
- metadata +39 -29
|
@@ -34,6 +34,11 @@ module VoucherifySdk
|
|
|
34
34
|
# Timestamp representing the date and time when the product collection was created. The value is shown in the ISO 8601 format.
|
|
35
35
|
attr_accessor :created_at
|
|
36
36
|
|
|
37
|
+
# Indicates whether the product collection can only be read by the caller in the Areas and Stores enterprise feature. Returned only when area and store visibility rules apply to the caller. A read-only product collection can't be updated or deleted.
|
|
38
|
+
attr_accessor :readonly
|
|
39
|
+
|
|
40
|
+
attr_accessor :access_settings_assignments
|
|
41
|
+
|
|
37
42
|
# The type of the object represented by JSON. This object stores information about the static product collection.
|
|
38
43
|
attr_accessor :object
|
|
39
44
|
|
|
@@ -68,6 +73,8 @@ module VoucherifySdk
|
|
|
68
73
|
:'filter' => :'filter',
|
|
69
74
|
:'products' => :'products',
|
|
70
75
|
:'created_at' => :'created_at',
|
|
76
|
+
:'readonly' => :'readonly',
|
|
77
|
+
:'access_settings_assignments' => :'access_settings_assignments',
|
|
71
78
|
:'object' => :'object'
|
|
72
79
|
}
|
|
73
80
|
end
|
|
@@ -86,6 +93,8 @@ module VoucherifySdk
|
|
|
86
93
|
:'filter' => :'Object',
|
|
87
94
|
:'products' => :'Array<ProductCollectionsItemProductsItem>',
|
|
88
95
|
:'created_at' => :'Time',
|
|
96
|
+
:'readonly' => :'Boolean',
|
|
97
|
+
:'access_settings_assignments' => :'AccessSettingsProductCollectionAssignmentsList',
|
|
89
98
|
:'object' => :'String'
|
|
90
99
|
}
|
|
91
100
|
end
|
|
@@ -99,6 +108,7 @@ module VoucherifySdk
|
|
|
99
108
|
:'filter',
|
|
100
109
|
:'products',
|
|
101
110
|
:'created_at',
|
|
111
|
+
:'readonly',
|
|
102
112
|
:'object'
|
|
103
113
|
])
|
|
104
114
|
end
|
|
@@ -137,6 +147,14 @@ module VoucherifySdk
|
|
|
137
147
|
self.created_at = attributes[:'created_at']
|
|
138
148
|
end
|
|
139
149
|
|
|
150
|
+
if attributes.key?(:'readonly')
|
|
151
|
+
self.readonly = attributes[:'readonly']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'access_settings_assignments')
|
|
155
|
+
self.access_settings_assignments = attributes[:'access_settings_assignments']
|
|
156
|
+
end
|
|
157
|
+
|
|
140
158
|
if attributes.key?(:'object')
|
|
141
159
|
self.object = attributes[:'object']
|
|
142
160
|
else
|
|
@@ -174,6 +192,8 @@ module VoucherifySdk
|
|
|
174
192
|
filter == o.filter &&
|
|
175
193
|
products == o.products &&
|
|
176
194
|
created_at == o.created_at &&
|
|
195
|
+
readonly == o.readonly &&
|
|
196
|
+
access_settings_assignments == o.access_settings_assignments &&
|
|
177
197
|
object == o.object
|
|
178
198
|
end
|
|
179
199
|
|
|
@@ -186,7 +206,7 @@ module VoucherifySdk
|
|
|
186
206
|
# Calculates hash code according to all attributes.
|
|
187
207
|
# @return [Integer] Hash code
|
|
188
208
|
def hash
|
|
189
|
-
[id, name, type, filter, products, created_at, object].hash
|
|
209
|
+
[id, name, type, filter, products, created_at, readonly, access_settings_assignments, object].hash
|
|
190
210
|
end
|
|
191
211
|
|
|
192
212
|
# Builds the object from hash
|
|
@@ -22,7 +22,7 @@ module VoucherifySdk
|
|
|
22
22
|
# Identifies the name of the JSON property that contains the array of product collections.
|
|
23
23
|
attr_accessor :data_ref
|
|
24
24
|
|
|
25
|
-
# A dictionary that contains an array of product collections and their details.
|
|
25
|
+
# A dictionary that contains an array of product collections and their details. <Note>If the Areas and Stores enterprise feature is enabled for product collections, this list does not return `access_settings_assignments`. To get the areas and stores to which a product collection is assigned, use [GET Product Collection](/api-reference/product-collections/get-product-collection). Contact [Voucherify Sales](https://www.voucherify.io/contact-sales) to learn more.</Note>
|
|
26
26
|
attr_accessor :data
|
|
27
27
|
|
|
28
28
|
# Total number of product collections.
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module VoucherifySdk
|
|
17
|
-
# Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`.
|
|
17
|
+
# Object representing legacy loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`.
|
|
18
18
|
class RedeemableVoucherLoyaltyCard
|
|
19
19
|
# Total number of points added to the loyalty card over its lifespan.
|
|
20
20
|
attr_accessor :points
|
|
@@ -19,7 +19,7 @@ module VoucherifySdk
|
|
|
19
19
|
# Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API. For `AUTO_REDEEM`, it is the reward assignment ID.
|
|
20
20
|
attr_accessor :channel_id
|
|
21
21
|
|
|
22
|
-
# The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard, `API` corresponds to the API, and `AUTO_REDEEM` corresponds to a loyalty campaign reward that has been redeemed automatically.
|
|
22
|
+
# The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard, `API` corresponds to the API, and `AUTO_REDEEM` corresponds to a **legacy loyalty** campaign reward that has been redeemed automatically.
|
|
23
23
|
attr_accessor :channel_type
|
|
24
24
|
|
|
25
25
|
class EnumAttributeValidator
|
|
@@ -49,7 +49,7 @@ module VoucherifySdk
|
|
|
49
49
|
# A set of custom key/value pairs that you can attach to a reward. The metadata object stores all custom attributes assigned to the reward.
|
|
50
50
|
attr_accessor :metadata
|
|
51
51
|
|
|
52
|
-
# Reward type.
|
|
52
|
+
# Reward type. `LOYALTY_POINTS` credits points on a `v2/loyalties` (loyalty hub) card (for example from a referral tier).
|
|
53
53
|
attr_accessor :type
|
|
54
54
|
|
|
55
55
|
class EnumAttributeValidator
|
|
@@ -216,7 +216,7 @@ module VoucherifySdk
|
|
|
216
216
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
217
217
|
object_validator = EnumAttributeValidator.new('String', ["reward"])
|
|
218
218
|
return false unless object_validator.valid?(@object)
|
|
219
|
-
type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"])
|
|
219
|
+
type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL", "LOYALTY_POINTS"])
|
|
220
220
|
return false unless type_validator.valid?(@type)
|
|
221
221
|
true
|
|
222
222
|
end
|
|
@@ -14,12 +14,12 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module VoucherifySdk
|
|
17
|
-
# Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.
|
|
17
|
+
# Defines the ratio by mapping the number of loyalty points (**legacy loyalty**) in `points_ratio` to a predefined cash amount in `exchange_ratio`.
|
|
18
18
|
class RedemptionRewardResultParametersCoin
|
|
19
19
|
# The cash equivalent of the points defined in the `points_ratio` property.
|
|
20
20
|
attr_accessor :exchange_ratio
|
|
21
21
|
|
|
22
|
-
# The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property.
|
|
22
|
+
# The number of loyalty points (**legacy loyalty**) that will map to the predefined cash amount defined by the `exchange_ratio` property.
|
|
23
23
|
attr_accessor :points_ratio
|
|
24
24
|
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module VoucherifySdk
|
|
17
|
-
# Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`.
|
|
17
|
+
# Object representing legacy loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`. Defaults to `null`.
|
|
18
18
|
class RedemptionVoucherLoyaltyCard
|
|
19
19
|
# Total number of points added to the loyalty card over its lifespan.
|
|
20
20
|
attr_accessor :points
|
|
@@ -32,7 +32,7 @@ module VoucherifySdk
|
|
|
32
32
|
# The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format.
|
|
33
33
|
attr_accessor :metadata
|
|
34
34
|
|
|
35
|
-
# Reward type.
|
|
35
|
+
# Reward type. `LOYALTY_POINTS` credits points on a `v2/loyalties` (loyalty hub) card (for example from a referral tier).
|
|
36
36
|
attr_accessor :type
|
|
37
37
|
|
|
38
38
|
attr_accessor :parameters
|
|
@@ -193,7 +193,7 @@ module VoucherifySdk
|
|
|
193
193
|
# @return true if the model is valid
|
|
194
194
|
def valid?
|
|
195
195
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
196
|
-
type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL"])
|
|
196
|
+
type_validator = EnumAttributeValidator.new('String', ["CAMPAIGN", "COIN", "MATERIAL", "LOYALTY_POINTS"])
|
|
197
197
|
return false unless type_validator.valid?(@type)
|
|
198
198
|
return false if @object.nil?
|
|
199
199
|
object_validator = EnumAttributeValidator.new('String', ["reward"])
|
|
@@ -30,10 +30,10 @@ module VoucherifySdk
|
|
|
30
30
|
# The type of the object represented by the JSON. This object stores information about the reward assignment.
|
|
31
31
|
attr_accessor :object
|
|
32
32
|
|
|
33
|
-
# Related object ID to which the reward was assigned.
|
|
33
|
+
# Related object ID to which the reward was assigned. For `related_object_type` `campaign`, this is the campaign ID. For `referral_tier`, this is the referral tier ID.
|
|
34
34
|
attr_accessor :related_object_id
|
|
35
35
|
|
|
36
|
-
# Related object type to which the reward was assigned.
|
|
36
|
+
# Related object type to which the reward was assigned. Use `campaign` for **legacy loyalty** campaign rewards. Use `referral_tier` for `LOYALTY_POINTS` rewards that credit a `v2/loyalties` (loyalty hub) card from a referral tier. A `LOYALTY_POINTS` reward can only be assigned to a referral tier.
|
|
37
37
|
attr_accessor :related_object_type
|
|
38
38
|
|
|
39
39
|
attr_accessor :parameters
|
|
@@ -166,7 +166,7 @@ module VoucherifySdk
|
|
|
166
166
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
167
167
|
object_validator = EnumAttributeValidator.new('String', ["reward_assignment"])
|
|
168
168
|
return false unless object_validator.valid?(@object)
|
|
169
|
-
related_object_type_validator = EnumAttributeValidator.new('String', ["campaign"])
|
|
169
|
+
related_object_type_validator = EnumAttributeValidator.new('String', ["campaign", "referral_tier"])
|
|
170
170
|
return false unless related_object_type_validator.valid?(@related_object_type)
|
|
171
171
|
true
|
|
172
172
|
end
|
|
@@ -19,7 +19,7 @@ module VoucherifySdk
|
|
|
19
19
|
# The number of points required to redeem the reward.
|
|
20
20
|
attr_accessor :points
|
|
21
21
|
|
|
22
|
-
# Determines if the reward is redeemed automatically when the customer reaches the sufficient number of points to redeem it. Value `true` means that the automatic reward redemption is active. Only one reward can be set to be redeemed automatically in a loyalty campaign, i.e. only one can have the value `true`.
|
|
22
|
+
# Determines if the reward is redeemed automatically when the customer reaches the sufficient number of points to redeem it. Value `true` means that the automatic reward redemption is active. Only one reward can be set to be redeemed automatically in a **legacy loyalty** campaign, i.e. only one can have the value `true`.
|
|
23
23
|
attr_accessor :auto_redeem
|
|
24
24
|
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -21,12 +21,15 @@ module VoucherifySdk
|
|
|
21
21
|
|
|
22
22
|
attr_accessor :product
|
|
23
23
|
|
|
24
|
+
attr_accessor :loyalty_points
|
|
25
|
+
|
|
24
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
27
|
def self.attribute_map
|
|
26
28
|
{
|
|
27
29
|
:'campaign' => :'campaign',
|
|
28
30
|
:'coin' => :'coin',
|
|
29
|
-
:'product' => :'product'
|
|
31
|
+
:'product' => :'product',
|
|
32
|
+
:'loyalty_points' => :'loyalty_points'
|
|
30
33
|
}
|
|
31
34
|
end
|
|
32
35
|
|
|
@@ -40,7 +43,8 @@ module VoucherifySdk
|
|
|
40
43
|
{
|
|
41
44
|
:'campaign' => :'RewardTypeCampaign',
|
|
42
45
|
:'coin' => :'RewardTypeCoin',
|
|
43
|
-
:'product' => :'RewardTypeProduct'
|
|
46
|
+
:'product' => :'RewardTypeProduct',
|
|
47
|
+
:'loyalty_points' => :'RewardTypeLoyaltyPoints'
|
|
44
48
|
}
|
|
45
49
|
end
|
|
46
50
|
|
|
@@ -49,7 +53,8 @@ module VoucherifySdk
|
|
|
49
53
|
Set.new([
|
|
50
54
|
:'campaign',
|
|
51
55
|
:'coin',
|
|
52
|
-
:'product'
|
|
56
|
+
:'product',
|
|
57
|
+
:'loyalty_points'
|
|
53
58
|
])
|
|
54
59
|
end
|
|
55
60
|
|
|
@@ -72,6 +77,10 @@ module VoucherifySdk
|
|
|
72
77
|
if attributes.key?(:'product')
|
|
73
78
|
self.product = attributes[:'product']
|
|
74
79
|
end
|
|
80
|
+
|
|
81
|
+
if attributes.key?(:'loyalty_points')
|
|
82
|
+
self.loyalty_points = attributes[:'loyalty_points']
|
|
83
|
+
end
|
|
75
84
|
end
|
|
76
85
|
|
|
77
86
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -96,7 +105,8 @@ module VoucherifySdk
|
|
|
96
105
|
self.class == o.class &&
|
|
97
106
|
campaign == o.campaign &&
|
|
98
107
|
coin == o.coin &&
|
|
99
|
-
product == o.product
|
|
108
|
+
product == o.product &&
|
|
109
|
+
loyalty_points == o.loyalty_points
|
|
100
110
|
end
|
|
101
111
|
|
|
102
112
|
# @see the `==` method
|
|
@@ -108,7 +118,7 @@ module VoucherifySdk
|
|
|
108
118
|
# Calculates hash code according to all attributes.
|
|
109
119
|
# @return [Integer] Hash code
|
|
110
120
|
def hash
|
|
111
|
-
[campaign, coin, product].hash
|
|
121
|
+
[campaign, coin, product, loyalty_points].hash
|
|
112
122
|
end
|
|
113
123
|
|
|
114
124
|
# Builds the object from hash
|
|
@@ -14,12 +14,12 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module VoucherifySdk
|
|
17
|
-
# Defines the ratio by mapping the number of loyalty points in
|
|
17
|
+
# Defines the ratio by mapping the number of legacy loyalty points in `points_rati`o to a predefined cash amount in `exchange_ratio`.
|
|
18
18
|
class RewardTypeCoin
|
|
19
|
-
# The cash equivalent of the points defined in the points_ratio property.
|
|
19
|
+
# The cash equivalent of the points defined in the `points_ratio` property.
|
|
20
20
|
attr_accessor :exchange_ratio
|
|
21
21
|
|
|
22
|
-
# The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property.
|
|
22
|
+
# The number of loyalty points (**legacy loyalty**) that will map to the predefined cash amount defined by the `exchange_ratio` property.
|
|
23
23
|
attr_accessor :points_ratio
|
|
24
24
|
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -0,0 +1,284 @@
|
|
|
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 how many points to credit on a `v2/loyalties` (loyalty hub) card, which program and card definition receive them, and what happens when the customer is not a member yet.
|
|
18
|
+
class RewardTypeLoyaltyPoints
|
|
19
|
+
# Number of points to credit. Must be greater than `0`.
|
|
20
|
+
attr_accessor :points
|
|
21
|
+
|
|
22
|
+
# Unique `v2/loyalties` (loyalty hub) program ID, assigned by Voucherify.
|
|
23
|
+
attr_accessor :program_id
|
|
24
|
+
|
|
25
|
+
# Unique card definition ID of the `v2/loyalties` (loyalty hub) card that receives the points.
|
|
26
|
+
attr_accessor :card_definition_id
|
|
27
|
+
|
|
28
|
+
# Action when the customer is not a member of the program. `ENROLL` enrolls the customer and credits the points. `REJECT` rejects the award and the customer is not enrolled.
|
|
29
|
+
attr_accessor :on_missing_member
|
|
30
|
+
|
|
31
|
+
class EnumAttributeValidator
|
|
32
|
+
attr_reader :datatype
|
|
33
|
+
attr_reader :allowable_values
|
|
34
|
+
|
|
35
|
+
def initialize(datatype, allowable_values)
|
|
36
|
+
@allowable_values = allowable_values.map do |value|
|
|
37
|
+
case datatype.to_s
|
|
38
|
+
when /Integer/i
|
|
39
|
+
value.to_i
|
|
40
|
+
when /Float/i
|
|
41
|
+
value.to_f
|
|
42
|
+
else
|
|
43
|
+
value
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def valid?(value)
|
|
49
|
+
!value || allowable_values.include?(value)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
54
|
+
def self.attribute_map
|
|
55
|
+
{
|
|
56
|
+
:'points' => :'points',
|
|
57
|
+
:'program_id' => :'program_id',
|
|
58
|
+
:'card_definition_id' => :'card_definition_id',
|
|
59
|
+
:'on_missing_member' => :'on_missing_member'
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Returns all the JSON keys this model knows about
|
|
64
|
+
def self.acceptable_attributes
|
|
65
|
+
attribute_map.values
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Attribute type mapping.
|
|
69
|
+
def self.openapi_types
|
|
70
|
+
{
|
|
71
|
+
:'points' => :'Integer',
|
|
72
|
+
:'program_id' => :'String',
|
|
73
|
+
:'card_definition_id' => :'String',
|
|
74
|
+
:'on_missing_member' => :'String'
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# List of attributes with nullable: true
|
|
79
|
+
def self.openapi_nullable
|
|
80
|
+
Set.new([
|
|
81
|
+
:'points',
|
|
82
|
+
:'program_id',
|
|
83
|
+
:'card_definition_id',
|
|
84
|
+
:'on_missing_member'
|
|
85
|
+
])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Initializes the object
|
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
90
|
+
def initialize(attributes = {})
|
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
92
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
93
|
+
h[k.to_sym] = v
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'points')
|
|
97
|
+
self.points = attributes[:'points']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'program_id')
|
|
101
|
+
self.program_id = attributes[:'program_id']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'card_definition_id')
|
|
105
|
+
self.card_definition_id = attributes[:'card_definition_id']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'on_missing_member')
|
|
109
|
+
self.on_missing_member = attributes[:'on_missing_member']
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
117
|
+
invalid_properties = Array.new
|
|
118
|
+
if !@points.nil? && @points < 1
|
|
119
|
+
invalid_properties.push('invalid value for "points", must be greater than or equal to 1.')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
pattern = Regexp.new(/^lprg_[a-f0-9]+$/)
|
|
123
|
+
if !@program_id.nil? && @program_id !~ pattern
|
|
124
|
+
invalid_properties.push("invalid value for \"program_id\", must conform to the pattern #{pattern}.")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
pattern = Regexp.new(/^lcdef_[a-f0-9]+$/)
|
|
128
|
+
if !@card_definition_id.nil? && @card_definition_id !~ pattern
|
|
129
|
+
invalid_properties.push("invalid value for \"card_definition_id\", must conform to the pattern #{pattern}.")
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
invalid_properties
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Check to see if the all the properties in the model are valid
|
|
136
|
+
# @return true if the model is valid
|
|
137
|
+
def valid?
|
|
138
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
139
|
+
return false if !@points.nil? && @points < 1
|
|
140
|
+
return false if !@program_id.nil? && @program_id !~ Regexp.new(/^lprg_[a-f0-9]+$/)
|
|
141
|
+
return false if !@card_definition_id.nil? && @card_definition_id !~ Regexp.new(/^lcdef_[a-f0-9]+$/)
|
|
142
|
+
on_missing_member_validator = EnumAttributeValidator.new('String', ["ENROLL", "REJECT"])
|
|
143
|
+
return false unless on_missing_member_validator.valid?(@on_missing_member)
|
|
144
|
+
true
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Checks equality by comparing each attribute.
|
|
148
|
+
# @param [Object] Object to be compared
|
|
149
|
+
def ==(o)
|
|
150
|
+
return true if self.equal?(o)
|
|
151
|
+
self.class == o.class &&
|
|
152
|
+
points == o.points &&
|
|
153
|
+
program_id == o.program_id &&
|
|
154
|
+
card_definition_id == o.card_definition_id &&
|
|
155
|
+
on_missing_member == o.on_missing_member
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# @see the `==` method
|
|
159
|
+
# @param [Object] Object to be compared
|
|
160
|
+
def eql?(o)
|
|
161
|
+
self == o
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Calculates hash code according to all attributes.
|
|
165
|
+
# @return [Integer] Hash code
|
|
166
|
+
def hash
|
|
167
|
+
[points, program_id, card_definition_id, on_missing_member].hash
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Builds the object from hash
|
|
171
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
172
|
+
# @return [Object] Returns the model itself
|
|
173
|
+
def self.build_from_hash(attributes)
|
|
174
|
+
return nil unless attributes.is_a?(Hash)
|
|
175
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
176
|
+
transformed_hash = {}
|
|
177
|
+
openapi_types.each_pair do |key, type|
|
|
178
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
179
|
+
transformed_hash["#{key}"] = nil
|
|
180
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
181
|
+
# check to ensure the input is an array given that the attribute
|
|
182
|
+
# is documented as an array but the input is not
|
|
183
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
184
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
185
|
+
end
|
|
186
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
187
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
new(transformed_hash)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Deserializes the data based on type
|
|
194
|
+
# @param string type Data type
|
|
195
|
+
# @param string value Value to be deserialized
|
|
196
|
+
# @return [Object] Deserialized data
|
|
197
|
+
def self._deserialize(type, value)
|
|
198
|
+
case type.to_sym
|
|
199
|
+
when :Time
|
|
200
|
+
Time.parse(value)
|
|
201
|
+
when :Date
|
|
202
|
+
Date.parse(value)
|
|
203
|
+
when :String
|
|
204
|
+
value.to_s
|
|
205
|
+
when :Integer
|
|
206
|
+
value.to_i
|
|
207
|
+
when :Float
|
|
208
|
+
value.to_f
|
|
209
|
+
when :Boolean
|
|
210
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
211
|
+
true
|
|
212
|
+
else
|
|
213
|
+
false
|
|
214
|
+
end
|
|
215
|
+
when :Object
|
|
216
|
+
# generic object (usually a Hash), return directly
|
|
217
|
+
value
|
|
218
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
219
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
220
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
221
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
222
|
+
k_type = Regexp.last_match[:k_type]
|
|
223
|
+
v_type = Regexp.last_match[:v_type]
|
|
224
|
+
{}.tap do |hash|
|
|
225
|
+
value.each do |k, v|
|
|
226
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
else # model
|
|
230
|
+
# models (e.g. Pet) or oneOf
|
|
231
|
+
klass = VoucherifySdk.const_get(type)
|
|
232
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Returns the string representation of the object
|
|
237
|
+
# @return [String] String presentation of the object
|
|
238
|
+
def to_s
|
|
239
|
+
to_hash.to_s
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
243
|
+
# @return [Hash] Returns the object in the form of hash
|
|
244
|
+
def to_body
|
|
245
|
+
to_hash
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Returns the object in the form of hash
|
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
|
250
|
+
def to_hash
|
|
251
|
+
hash = {}
|
|
252
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
253
|
+
value = self.send(attr)
|
|
254
|
+
if value.nil?
|
|
255
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
256
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
hash[param] = _to_hash(value)
|
|
260
|
+
end
|
|
261
|
+
hash
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Outputs non-array value in the form of hash
|
|
265
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
266
|
+
# @param [Object] value Any valid value
|
|
267
|
+
# @return [Hash] Returns the value in the form of hash
|
|
268
|
+
def _to_hash(value)
|
|
269
|
+
if value.is_a?(Array)
|
|
270
|
+
value.compact.map { |v| _to_hash(v) }
|
|
271
|
+
elsif value.is_a?(Hash)
|
|
272
|
+
{}.tap do |hash|
|
|
273
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
274
|
+
end
|
|
275
|
+
elsif value.respond_to? :to_hash
|
|
276
|
+
value.to_hash
|
|
277
|
+
else
|
|
278
|
+
value
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
end
|